diff --git a/.gitignore b/.gitignore index 981ed083..926b3af3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ Icon* .tags* xray_wasm/dist xray_browser/dist -memo_wasm/dist +memo_js/dist diff --git a/Cargo.lock b/Cargo.lock index d6a7468f..6230b40b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -433,7 +433,7 @@ dependencies = [ ] [[package]] -name = "memo_wasm" +name = "memo_js" version = "0.1.0" dependencies = [ "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index e0d8ffd7..badae682 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = [ "memo_core", - "memo_wasm", + "memo_js", "xray_core", "xray_server", "xray_cli", diff --git a/memo_js/dist/0.index.js b/memo_js/dist/0.index.js deleted file mode 100644 index ba2671a1..00000000 --- a/memo_js/dist/0.index.js +++ /dev/null @@ -1,27 +0,0 @@ -exports.ids = [0]; -exports.modules = { - -/***/ "./dist/memo_wasm.js": -/*!***************************!*\ - !*** ./dist/memo_wasm.js ***! - \***************************/ -/*! exports provided: Server, __wbindgen_object_drop_ref, __wbindgen_json_parse, __wbindgen_json_serialize, __wbindgen_throw */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Server\", function() { return Server; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_object_drop_ref\", function() { return __wbindgen_object_drop_ref; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_json_parse\", function() { return __wbindgen_json_parse; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_json_serialize\", function() { return __wbindgen_json_serialize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_throw\", function() { return __wbindgen_throw; });\n/* harmony import */ var _memo_wasm_bg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./memo_wasm_bg */ \"./dist/memo_wasm_bg.wasm\");\n/* tslint:disable */\n\n\nconst slab = [{ obj: undefined }, { obj: null }, { obj: true }, { obj: false }];\n\nlet slab_next = slab.length;\n\nfunction addHeapObject(obj) {\n if (slab_next === slab.length) slab.push(slab.length + 1);\n const idx = slab_next;\n const next = slab[idx];\n \n slab_next = next;\n \n slab[idx] = { obj, cnt: 1 };\n return idx << 1;\n}\n\nconst stack = [];\n\nfunction getObject(idx) {\n if ((idx & 1) === 1) {\n return stack[idx >> 1];\n } else {\n const val = slab[idx >> 1];\n \n return val.obj;\n \n }\n}\n\nfunction dropRef(idx) {\n \n idx = idx >> 1;\n if (idx < 4) return;\n let obj = slab[idx];\n \n obj.cnt -= 1;\n if (obj.cnt > 0) return;\n \n // If we hit 0 then free up our space in the slab\n slab[idx] = slab_next;\n slab_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropRef(idx);\n return ret;\n}\n\nfunction freeServer(ptr) {\n \n _memo_wasm_bg__WEBPACK_IMPORTED_MODULE_0__[\"__wbg_server_free\"](ptr);\n}\n/**\n*/\nclass Server {\n \n static __construct(ptr) {\n return new Server(ptr);\n }\n \n constructor(ptr) {\n this.ptr = ptr;\n \n }\n \n free() {\n const ptr = this.ptr;\n this.ptr = 0;\n freeServer(ptr);\n }\n /**\n * @returns {Server}\n */\n static new() {\n return Server.__construct(_memo_wasm_bg__WEBPACK_IMPORTED_MODULE_0__[\"server_new\"]());\n }\n /**\n * @param {any} arg0\n * @returns {any}\n */\n request(arg0) {\n if (this.ptr === 0) {\n throw new Error('Attempt to use a moved value');\n }\n return takeObject(_memo_wasm_bg__WEBPACK_IMPORTED_MODULE_0__[\"server_request\"](this.ptr, addHeapObject(arg0)));\n }\n}\n\nfunction __wbindgen_object_drop_ref(i) {\n dropRef(i);\n}\n\nconst TextDecoder = typeof self === 'object' && self.TextDecoder\n ? self.TextDecoder\n : __webpack_require__(/*! util */ \"util\").TextDecoder;\n\nlet cachedDecoder = new TextDecoder('utf-8');\n\nlet cachegetUint8Memory = null;\nfunction getUint8Memory() {\n if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== _memo_wasm_bg__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer) {\n cachegetUint8Memory = new Uint8Array(_memo_wasm_bg__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer);\n }\n return cachegetUint8Memory;\n}\n\nfunction getStringFromWasm(ptr, len) {\n return cachedDecoder.decode(getUint8Memory().subarray(ptr, ptr + len));\n}\n\nfunction __wbindgen_json_parse(ptr, len) {\n return addHeapObject(JSON.parse(getStringFromWasm(ptr, len)));\n}\n\nconst TextEncoder = typeof self === 'object' && self.TextEncoder\n ? self.TextEncoder\n : __webpack_require__(/*! util */ \"util\").TextEncoder;\n\nlet cachedEncoder = new TextEncoder('utf-8');\n\nfunction passStringToWasm(arg) {\n \n const buf = cachedEncoder.encode(arg);\n const ptr = _memo_wasm_bg__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_malloc\"](buf.length);\n getUint8Memory().set(buf, ptr);\n return [ptr, buf.length];\n}\n\nlet cachegetUint32Memory = null;\nfunction getUint32Memory() {\n if (cachegetUint32Memory === null || cachegetUint32Memory.buffer !== _memo_wasm_bg__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer) {\n cachegetUint32Memory = new Uint32Array(_memo_wasm_bg__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer);\n }\n return cachegetUint32Memory;\n}\n\nfunction __wbindgen_json_serialize(idx, ptrptr) {\n const [ptr, len] = passStringToWasm(JSON.stringify(getObject(idx)));\n getUint32Memory()[ptrptr / 4] = ptr;\n return len;\n}\n\nfunction __wbindgen_throw(ptr, len) {\n throw new Error(getStringFromWasm(ptr, len));\n}\n\n\n\n//# sourceURL=webpack://memo/./dist/memo_wasm.js?"); - -/***/ }), - -/***/ "./dist/memo_wasm_bg.wasm": -/*!********************************!*\ - !*** ./dist/memo_wasm_bg.wasm ***! - \********************************/ -/*! exports provided: memory, __indirect_function_table, __heap_base, __data_end, __wbindgen_malloc, __wbg_server_free, server_new, server_request */ -/***/ (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__(/*! ./memo_wasm */ \"./dist/memo_wasm.js\");\n\n\n// exec wasm module\nwasmExports[\"__webpack_init__\"]()\n\n//# sourceURL=webpack://memo/./dist/memo_wasm_bg.wasm?"); - -/***/ }) - -};; \ No newline at end of file diff --git a/memo_js/dist/04b973392e9496048e48.module.wasm b/memo_js/dist/04b973392e9496048e48.module.wasm deleted file mode 100644 index 1c73ddd0..00000000 Binary files a/memo_js/dist/04b973392e9496048e48.module.wasm and /dev/null differ diff --git a/memo_js/dist/index.js b/memo_js/dist/index.js deleted file mode 100644 index 02587f60..00000000 --- a/memo_js/dist/index.js +++ /dev/null @@ -1,233 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["memo"] = factory(); - else - root["memo"] = factory(); -})(global, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // object to store loaded chunks -/******/ // "0" means "already loaded" -/******/ var installedChunks = { -/******/ "main": 0 -/******/ }; -/******/ -/******/ // object to store loaded and loading wasm modules -/******/ var installedWasmModules = {}; -/******/ -/******/ function promiseResolve() { return Promise.resolve(); } -/******/ -/******/ var wasmImportObjects = { -/******/ "./dist/memo_wasm_bg.wasm": function() { -/******/ return { -/******/ "./memo_wasm": { -/******/ "__wbindgen_throw": function(p0i32,p1i32) { -/******/ return installedModules["./dist/memo_wasm.js"].exports["__wbindgen_throw"](p0i32,p1i32); -/******/ }, -/******/ "__wbindgen_json_serialize": function(p0i32,p1i32) { -/******/ return installedModules["./dist/memo_wasm.js"].exports["__wbindgen_json_serialize"](p0i32,p1i32); -/******/ }, -/******/ "__wbindgen_json_parse": function(p0i32,p1i32) { -/******/ return installedModules["./dist/memo_wasm.js"].exports["__wbindgen_json_parse"](p0i32,p1i32); -/******/ }, -/******/ "__wbindgen_object_drop_ref": function(p0i32) { -/******/ return installedModules["./dist/memo_wasm.js"].exports["__wbindgen_object_drop_ref"](p0i32); -/******/ } -/******/ } -/******/ }; -/******/ }, -/******/ }; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ // This file contains only the entry chunk. -/******/ // The chunk loading function for additional chunks -/******/ __webpack_require__.e = function requireEnsure(chunkId) { -/******/ var promises = []; -/******/ -/******/ -/******/ // require() chunk loading for javascript -/******/ -/******/ // "0" is the signal for "already loaded" -/******/ if(installedChunks[chunkId] !== 0) { -/******/ var chunk = require("./" + chunkId + ".index.js"); -/******/ var moreModules = chunk.modules, chunkIds = chunk.ids; -/******/ for(var moduleId in moreModules) { -/******/ modules[moduleId] = moreModules[moduleId]; -/******/ } -/******/ for(var i = 0; i < chunkIds.length; i++) -/******/ installedChunks[chunkIds[i]] = 0; -/******/ } -/******/ -/******/ // Fetch + compile chunk loading for webassembly -/******/ -/******/ var wasmModules = {"0":["./dist/memo_wasm_bg.wasm"]}[chunkId] || []; -/******/ -/******/ wasmModules.forEach(function(wasmModuleId) { -/******/ var installedWasmModuleData = installedWasmModules[wasmModuleId]; -/******/ -/******/ // a Promise means "currently loading" or "already loaded". -/******/ if(installedWasmModuleData) -/******/ promises.push(installedWasmModuleData); -/******/ else { -/******/ var importObject = wasmImportObjects[wasmModuleId](); -/******/ var req = new Promise(function (resolve, reject) { -/******/ var { readFile } = require('fs'); -/******/ var { join } = require('path'); -/******/ -/******/ try { -/******/ readFile(join(__dirname, "" + {"./dist/memo_wasm_bg.wasm":"04b973392e9496048e48"}[wasmModuleId] + ".module.wasm"), function(err, buffer){ -/******/ if (err) return reject(err); -/******/ -/******/ // Fake fetch response -/******/ resolve({ -/******/ arrayBuffer() { return Promise.resolve(buffer); } -/******/ }); -/******/ }); -/******/ } catch (err) { reject(err); } -/******/ }); -/******/ var promise; -/******/ if(importObject instanceof Promise) { -/******/ var bytesPromise = req.then(function(x) { return x.arrayBuffer(); }); -/******/ promise = Promise.all([ -/******/ bytesPromise.then(function(bytes) { return WebAssembly.compile(bytes); }), -/******/ importObject -/******/ ]).then(function(items) { -/******/ return WebAssembly.instantiate(items[0], items[1]); -/******/ }); -/******/ } else { -/******/ var bytesPromise = req.then(function(x) { return x.arrayBuffer(); }); -/******/ promise = bytesPromise.then(function(bytes) { -/******/ return WebAssembly.instantiate(bytes, importObject); -/******/ }); -/******/ } -/******/ promises.push(installedWasmModules[wasmModuleId] = promise.then(function(res) { -/******/ return __webpack_require__.w[wasmModuleId] = (res.instance || res).exports; -/******/ })); -/******/ } -/******/ }); -/******/ return Promise.all(promises); -/******/ }; -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // uncaught error handler for webpack runtime -/******/ __webpack_require__.oe = function(err) { -/******/ process.nextTick(function() { -/******/ throw err; // catch this error by using import().catch() -/******/ }); -/******/ }; -/******/ -/******/ // object with all WebAssembly.instance exports -/******/ __webpack_require__.w = {}; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./src/index.ts": -/*!**********************!*\ - !*** ./src/index.ts ***! - \**********************/ -/*! exports provided: init */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"init\", function() { return init; });\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar server;\nfunction init() {\n return __awaiter(this, void 0, void 0, function () {\n var memo;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, __webpack_require__.e(/*! import() */ 0).then(__webpack_require__.bind(null, /*! ../dist/memo_wasm */ \"./dist/memo_wasm.js\"))];\n case 1:\n memo = _a.sent();\n if (!server) {\n server = memo.Server[\"new\"]();\n }\n return [2 /*return*/, { WorkTree: WorkTree }];\n }\n });\n });\n}\nfunction request(req) {\n var response = server.request(req);\n if (response.type == \"Error\") {\n throw new Error(response.message);\n }\n else {\n return response;\n }\n}\nvar FileType;\n(function (FileType) {\n FileType[\"Directory\"] = \"Directory\";\n FileType[\"File\"] = \"File\";\n})(FileType || (FileType = {}));\nvar FileStatus;\n(function (FileStatus) {\n FileStatus[\"New\"] = \"New\";\n FileStatus[\"Renamed\"] = \"Renamed\";\n FileStatus[\"Removed\"] = \"Removed\";\n FileStatus[\"Modified\"] = \"Modified\";\n FileStatus[\"Unchanged\"] = \"Unchanged\";\n})(FileStatus || (FileStatus = {}));\nvar WorkTree = /** @class */ (function () {\n function WorkTree(replicaId) {\n this.id = request({\n type: \"CreateWorkTree\",\n replica_id: replicaId\n }).tree_id;\n }\n WorkTree.getRootFileId = function () {\n if (!WorkTree.rootFileId) {\n WorkTree.rootFileId = request({ type: \"GetRootFileId\" }).file_id;\n }\n return WorkTree.rootFileId;\n };\n WorkTree.prototype.getVersion = function () {\n return request({ tree_id: this.id, type: \"GetVersion\" }).version;\n };\n WorkTree.prototype.appendBaseEntries = function (baseEntries) {\n return request({\n type: \"AppendBaseEntries\",\n tree_id: this.id,\n entries: baseEntries\n }).operations;\n };\n WorkTree.prototype.applyOps = function (operations) {\n var response = request({\n type: \"ApplyOperations\",\n tree_id: this.id,\n operations: operations\n });\n return response.operations;\n };\n WorkTree.prototype.newTextFile = function () {\n var _a = request({\n type: \"NewTextFile\",\n tree_id: this.id\n }), file_id = _a.file_id, operation = _a.operation;\n return { fileId: file_id, operation: operation };\n };\n WorkTree.prototype.createDirectory = function (parentId, name) {\n var _a = request({\n type: \"CreateDirectory\",\n tree_id: this.id,\n parent_id: parentId,\n name: name\n }), file_id = _a.file_id, operation = _a.operation;\n return { fileId: file_id, operation: operation };\n };\n WorkTree.prototype.openTextFile = function (fileId, baseText) {\n var response = request({\n type: \"OpenTextFile\",\n tree_id: this.id,\n file_id: fileId,\n base_text: baseText\n });\n return response.buffer_id;\n };\n WorkTree.prototype.rename = function (fileId, newParentId, newName) {\n return request({\n type: \"Rename\",\n tree_id: this.id,\n file_id: fileId,\n new_parent_id: newParentId,\n new_name: newName\n }).operation;\n };\n WorkTree.prototype.remove = function (fileId) {\n return request({\n type: \"Remove\",\n tree_id: this.id,\n file_id: fileId\n }).operation;\n };\n WorkTree.prototype.edit = function (bufferId, ranges, newText) {\n var response = request({\n type: \"Edit\",\n tree_id: this.id,\n buffer_id: bufferId,\n ranges: ranges,\n new_text: newText\n });\n return response.operation;\n };\n WorkTree.prototype.changesSince = function (bufferId, version) {\n return request({\n type: \"ChangesSince\",\n tree_id: this.id,\n buffer_id: bufferId,\n version: version\n }).changes;\n };\n WorkTree.prototype.getText = function (bufferId) {\n return request({\n type: \"GetText\",\n tree_id: this.id,\n buffer_id: bufferId\n }).text;\n };\n WorkTree.prototype.fileIdForPath = function (path) {\n return request({\n type: \"FileIdForPath\",\n tree_id: this.id,\n path: path\n }).file_id;\n };\n WorkTree.prototype.pathForFileId = function (id) {\n return request({\n type: \"PathForFileId\",\n tree_id: this.id,\n file_id: id\n }).path;\n };\n WorkTree.prototype.entries = function (options) {\n var showDeleted, descendInto;\n if (options) {\n showDeleted = options.showDeleted || false;\n descendInto = options.descendInto || null;\n }\n else {\n showDeleted = false;\n descendInto = null;\n }\n return request({\n type: \"Entries\",\n tree_id: this.id,\n show_deleted: showDeleted,\n descend_into: descendInto\n }).entries;\n };\n return WorkTree;\n}());\n\n\n//# sourceURL=webpack://memo/./src/index.ts?"); - -/***/ }), - -/***/ "util": -/*!***********************!*\ - !*** external "util" ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -eval("module.exports = require(\"util\");\n\n//# sourceURL=webpack://memo/external_%22util%22?"); - -/***/ }) - -/******/ }); -}); \ No newline at end of file diff --git a/memo_js/dist/memo_wasm.d.ts b/memo_js/dist/memo_wasm.d.ts deleted file mode 100644 index 53259708..00000000 --- a/memo_js/dist/memo_wasm.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* tslint:disable */ -export class Server { -free(): void; -static new(): Server; - - request(arg0: any): any; - -} diff --git a/memo_js/dist/memo_wasm.js b/memo_js/dist/memo_wasm.js deleted file mode 100644 index 3bfffda8..00000000 --- a/memo_js/dist/memo_wasm.js +++ /dev/null @@ -1,149 +0,0 @@ -/* tslint:disable */ -import * as wasm from './memo_wasm_bg'; - -const slab = [{ obj: undefined }, { obj: null }, { obj: true }, { obj: false }]; - -let slab_next = slab.length; - -function addHeapObject(obj) { - if (slab_next === slab.length) slab.push(slab.length + 1); - const idx = slab_next; - const next = slab[idx]; - - slab_next = next; - - slab[idx] = { obj, cnt: 1 }; - return idx << 1; -} - -const stack = []; - -function getObject(idx) { - if ((idx & 1) === 1) { - return stack[idx >> 1]; - } else { - const val = slab[idx >> 1]; - - return val.obj; - - } -} - -function dropRef(idx) { - - idx = idx >> 1; - if (idx < 4) return; - let obj = slab[idx]; - - obj.cnt -= 1; - if (obj.cnt > 0) return; - - // If we hit 0 then free up our space in the slab - slab[idx] = slab_next; - slab_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropRef(idx); - return ret; -} - -function freeServer(ptr) { - - wasm.__wbg_server_free(ptr); -} -/** -*/ -export class Server { - - static __construct(ptr) { - return new Server(ptr); - } - - constructor(ptr) { - this.ptr = ptr; - - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - freeServer(ptr); - } - /** - * @returns {Server} - */ - static new() { - return Server.__construct(wasm.server_new()); - } - /** - * @param {any} arg0 - * @returns {any} - */ - request(arg0) { - if (this.ptr === 0) { - throw new Error('Attempt to use a moved value'); - } - return takeObject(wasm.server_request(this.ptr, addHeapObject(arg0))); - } -} - -export function __wbindgen_object_drop_ref(i) { - dropRef(i); -} - -const TextDecoder = typeof self === 'object' && self.TextDecoder - ? self.TextDecoder - : require('util').TextDecoder; - -let cachedDecoder = new TextDecoder('utf-8'); - -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); - } - return cachegetUint8Memory; -} - -function getStringFromWasm(ptr, len) { - return cachedDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); -} - -export function __wbindgen_json_parse(ptr, len) { - return addHeapObject(JSON.parse(getStringFromWasm(ptr, len))); -} - -const TextEncoder = typeof self === 'object' && self.TextEncoder - ? self.TextEncoder - : require('util').TextEncoder; - -let cachedEncoder = new TextEncoder('utf-8'); - -function passStringToWasm(arg) { - - const buf = cachedEncoder.encode(arg); - const ptr = wasm.__wbindgen_malloc(buf.length); - getUint8Memory().set(buf, ptr); - return [ptr, buf.length]; -} - -let cachegetUint32Memory = null; -function getUint32Memory() { - if (cachegetUint32Memory === null || cachegetUint32Memory.buffer !== wasm.memory.buffer) { - cachegetUint32Memory = new Uint32Array(wasm.memory.buffer); - } - return cachegetUint32Memory; -} - -export function __wbindgen_json_serialize(idx, ptrptr) { - const [ptr, len] = passStringToWasm(JSON.stringify(getObject(idx))); - getUint32Memory()[ptrptr / 4] = ptr; - return len; -} - -export function __wbindgen_throw(ptr, len) { - throw new Error(getStringFromWasm(ptr, len)); -} - diff --git a/memo_js/dist/memo_wasm_bg.wasm b/memo_js/dist/memo_wasm_bg.wasm deleted file mode 100644 index fb40c13f..00000000 Binary files a/memo_js/dist/memo_wasm_bg.wasm and /dev/null differ diff --git a/memo_js/package-lock.json b/memo_js/package-lock.json index caa30e45..93b9f508 100644 --- a/memo_js/package-lock.json +++ b/memo_js/package-lock.json @@ -1,5 +1,5 @@ { - "name": "memo_wasm", + "name": "memo_js", "version": "0.1.0", "lockfileVersion": 1, "requires": true, diff --git a/memo_js/package.json b/memo_js/package.json index b7646914..41442e11 100644 --- a/memo_js/package.json +++ b/memo_js/package.json @@ -1,5 +1,5 @@ { - "name": "memo_wasm", + "name": "memo_js", "version": "0.1.0", "main": "dist/index.js", "browser": "src/index.js", diff --git a/memo_js/script/build b/memo_js/script/build index d130f7bb..52596e1f 100755 --- a/memo_js/script/build +++ b/memo_js/script/build @@ -19,5 +19,5 @@ setup_wasm_bindgen rm -rf dist mkdir -p dist CARGO_INCREMENTAL=0 RUSTFLAGS="-C debuginfo=0 -C opt-level=s -C lto -C panic=abort" cargo build --release --target wasm32-unknown-unknown -wasm-bindgen ../target/wasm32-unknown-unknown/release/memo_wasm.wasm --out-dir dist +wasm-bindgen ../target/wasm32-unknown-unknown/release/memo_js.wasm --out-dir dist node_modules/.bin/webpack --mode=development diff --git a/memo_js/src/index.ts b/memo_js/src/index.ts index 45058039..9b187458 100644 --- a/memo_js/src/index.ts +++ b/memo_js/src/index.ts @@ -1,7 +1,7 @@ let server: any; export async function init() { - const memo = await import("../dist/memo_wasm"); + const memo = await import("../dist/memo_js"); if (!server) { server = memo.Server.new(); } diff --git a/xray_electron/yarn.lock b/xray_electron/yarn.lock index 32ad4c66..89fc73a9 100644 --- a/xray_electron/yarn.lock +++ b/xray_electron/yarn.lock @@ -39,6 +39,10 @@ asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" +autosize@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/autosize/-/autosize-4.0.2.tgz#073cfd07c8bf45da4b9fd153437f5bafbba1e4c9" + aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -113,6 +117,10 @@ combined-stream@1.0.6, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" +computed-style@~0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/computed-style/-/computed-style-0.1.4.tgz#7f344fd8584b2e425bedca4a1afc0e300bb05d74" + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -512,6 +520,12 @@ klaw@^1.0.0: optionalDependencies: graceful-fs "^4.1.9" +line-height@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/line-height/-/line-height-0.3.1.tgz#4b1205edde182872a5efa3c8f620b3187a9c54c9" + dependencies: + computed-style "~0.1.3" + load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -708,6 +722,13 @@ promise@^7.1.1: dependencies: asap "~2.0.3" +prop-types@^15.5.6: + version "15.6.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" + dependencies: + loose-envify "^1.3.1" + object-assign "^4.1.1" + prop-types@^15.6.0: version "15.6.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.1.tgz#36644453564255ddda391191fb3a125cbdf654ca" @@ -733,6 +754,18 @@ rc@^1.1.2: minimist "^1.2.0" strip-json-comments "~2.0.1" +react-autosize-textarea@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/react-autosize-textarea/-/react-autosize-textarea-3.0.3.tgz#30e8e081f35eb73b3667dc01cf4e8927c278466b" + dependencies: + autosize "^4.0.0" + line-height "^0.3.1" + prop-types "^15.5.6" + +react-component-octicons@^1.6.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/react-component-octicons/-/react-component-octicons-1.8.0.tgz#60bc7491a8529d98060ff85db8b69ed3417698dc" + react-dom@^16.3.0: version "16.3.2" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.3.2.tgz#cb90f107e09536d683d84ed5d4888e9640e0e4df" @@ -1059,6 +1092,8 @@ xray_ui@../xray_ui: dependencies: prop-types "^15.6.0" react "^16.3.0" + react-autosize-textarea "^3.0.3" + react-component-octicons "^1.6.0" react-dom "^16.3.0" styletron-engine-atomic "1.0.4" styletron-react "4.0.3"