From 18a3faf2e4a7b2083e4875a702e2bb04c684de45 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Mon, 17 Apr 2023 19:41:28 -0400 Subject: [PATCH] Revert "Add wasm directly" This reverts commit a8019d4bf8a46230af32bf4784437935d0083958. --- web-frontend/.prettierignore | 1 - web-frontend/package.json | 3 +- web-frontend/src/lib/common.js | 30 ++--- web-frontend/src/lib/pkg | 1 - .../src/routes/app/CoordinateInfo.svelte | 11 +- web-frontend/vite.config.js | 11 +- web-frontend/yarn.lock | 111 ++++-------------- 7 files changed, 39 insertions(+), 129 deletions(-) delete mode 120000 web-frontend/src/lib/pkg diff --git a/web-frontend/.prettierignore b/web-frontend/.prettierignore index 5cf2d42..9353a6c 100644 --- a/web-frontend/.prettierignore +++ b/web-frontend/.prettierignore @@ -1,5 +1,4 @@ /src/lib/docs/* -/src/lib/pkg/* .DS_Store node_modules diff --git a/web-frontend/package.json b/web-frontend/package.json index c85a090..7935f22 100644 --- a/web-frontend/package.json +++ b/web-frontend/package.json @@ -32,8 +32,7 @@ "typescript": "^4.9.3", "vite": "^4.1.4", "vite-plugin-pwa": "^0.14.6", - "vite-plugin-top-level-await": "^1.3.0", - "vite-plugin-wasm": "^3.2.2" + "vite-plugin-wasm-pack": "^0.1.12" }, "type": "module", "dependencies": { diff --git a/web-frontend/src/lib/common.js b/web-frontend/src/lib/common.js index 53de828..8962149 100644 --- a/web-frontend/src/lib/common.js +++ b/web-frontend/src/lib/common.js @@ -1,9 +1,5 @@ -// import init from 'xpin-wasm'; -// import * as xpinWasm from 'xpin-wasm'; -import * as xpinWasm from '$lib/pkg/xpin_wasm.js'; -// import * as init from '$lib/pkg/xpin_wasm_bg.js'; -// import init from '$lib/pkg/xpin_wasm_bg.wasm?init'; -// import * as xpinWasm from '$lib/pkg/xpin_wasm.js'; +import init from 'xpin-wasm'; +import * as xpinWasm from 'xpin-wasm'; export const WasmStatus = { NotLoaded: -1, @@ -15,18 +11,16 @@ export async function getWasm() { let wasmStatus = WasmStatus.NotLoaded; let wasmError; - wasmStatus = WasmStatus.Loaded; - - // await init() - // .then(() => { - - // }) - // .catch((e) => { - // console.error('Error loading wasm module', e); - // wasmError = e; - // wasmStatus = WasmStatus.Errored; - // throw e; - // }); + await init() + .then(() => { + wasmStatus = WasmStatus.Loaded; + }) + .catch((e) => { + console.error('Error loading wasm module', e); + wasmError = e; + wasmStatus = WasmStatus.Errored; + throw e; + }); return { status: wasmStatus, diff --git a/web-frontend/src/lib/pkg b/web-frontend/src/lib/pkg deleted file mode 120000 index 14c1aec..0000000 --- a/web-frontend/src/lib/pkg +++ /dev/null @@ -1 +0,0 @@ -../../../xpin-wasm/pkg/ \ No newline at end of file diff --git a/web-frontend/src/routes/app/CoordinateInfo.svelte b/web-frontend/src/routes/app/CoordinateInfo.svelte index 6c47cf8..050f86e 100644 --- a/web-frontend/src/routes/app/CoordinateInfo.svelte +++ b/web-frontend/src/routes/app/CoordinateInfo.svelte @@ -4,16 +4,7 @@ export let xpin; let formats = ['dd', 'dms', 'dmm', 'utm', 'plus']; - let urlFormats = [ - 'google_maps', - 'geo', - 'openstreetmap', - 'waze', - 'apple_maps', - 'osmand', - 'bing_maps', - 'osmand_direct' - ]; + let urlFormats = ['google_maps', 'geo', 'openstreetmap', 'waze', 'apple_maps', 'osmand', 'bing_maps', 'osmand_direct']; onMount(() => { // TODO: Indicate that the data is copied diff --git a/web-frontend/vite.config.js b/web-frontend/vite.config.js index 7710c2f..9dd1eec 100644 --- a/web-frontend/vite.config.js +++ b/web-frontend/vite.config.js @@ -1,20 +1,15 @@ import { sveltekit } from '@sveltejs/kit/vite'; import { SvelteKitPWA } from '@vite-pwa/sveltekit'; +import wasmPack from 'vite-plugin-wasm-pack'; import { defineConfig } from 'vite'; -import wasm from "vite-plugin-wasm"; -import topLevelAwait from "vite-plugin-top-level-await"; export default defineConfig({ - plugins: [ - sveltekit(), SvelteKitPWA({ + plugins: [sveltekit(), wasmPack('../xpin-wasm/'), SvelteKitPWA({ workbox: { globPatterns: ['**/*.{js,html,wasm}'], }, devOptions: { enabled: true, }, - }), - wasm(), - topLevelAwait(), - ] + })] }); diff --git a/web-frontend/yarn.lock b/web-frontend/yarn.lock index 63abc80..b89c72a 100644 --- a/web-frontend/yarn.lock +++ b/web-frontend/yarn.lock @@ -1178,11 +1178,6 @@ "@rollup/pluginutils" "^5.0.1" magic-string "^0.27.0" -"@rollup/plugin-virtual@^3.0.1": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@rollup/plugin-virtual/-/plugin-virtual-3.0.1.tgz#cea7e489481cc0ca91516c047f8c53c1cfb1adf6" - integrity sha512-fK8O0IL5+q+GrsMLuACVNk2x21g3yaw+sG2qn16SnUd3IlBsQyvWxLMGHmCmXRMecPjGRSZ/1LmZB4rjQm68og== - "@rollup/pluginutils@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" @@ -1254,72 +1249,6 @@ svelte-hmr "^0.15.1" vitefu "^0.2.4" -"@swc/core-darwin-arm64@1.3.46": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.46.tgz#810a60fc330190e38c2da39ecae304ba3e44c2d6" - integrity sha512-kY4ASe7SsntDw2B1T70H9K1CFmK8POi+LyIpeCyC96EB9wbH2Sax+ploBB/wZALbYzr/dMJzOCU8QXzdmVS4Rg== - -"@swc/core-darwin-x64@1.3.46": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.46.tgz#d419c195191fbe230db5c34c08a5433901258dc9" - integrity sha512-kE3PMk8xW+2BZ3oZiTxxsUU/GzrGwM+qS4frOBz9TYHZe+W1dTtj4F9vBit4PFJ+tv4O6DPt9neGobzdq0UmRw== - -"@swc/core-linux-arm-gnueabihf@1.3.46": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.46.tgz#5e3bfd927bb5402f91a1784f03c7137ad82c2ea2" - integrity sha512-7TbiUr9MYxT+mC7sVrayag/isFoaZUG/ogkEK8B/ouA1pnIYqWh3N5ifqCzfcSRiOURt+vVqPyoO1puSiNzVuQ== - -"@swc/core-linux-arm64-gnu@1.3.46": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.46.tgz#da599aabfb2eae96f48cb2aae2949588af119316" - integrity sha512-Ycw4LU/wsUK9R+Y/2qFOPQseZDfM5D5gbWGrrYj5RoTm57FbnUsSsO26QeZxUNvams1oAQDkZDuerCc9qBRzIQ== - -"@swc/core-linux-arm64-musl@1.3.46": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.46.tgz#f4a9b50594b9e60a179fe80a9f03e6d126475909" - integrity sha512-cBclyr6IW1PBr8l9D4FkebgbqlkiIYnSJCbY84J/6PfTzQlD6w9a1TAoYxdGZpJ7SGHdmB0oDiZS1rhxCSCV/Q== - -"@swc/core-linux-x64-gnu@1.3.46": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.46.tgz#13a0407eac724a862165cfaf5f872f2cf5b0359c" - integrity sha512-amqMhTA2CXB6t11hVAZSSPKq4DZ9/sWbW3wYYQHxzqrMJML0726OJs4pt0XnlU7FzdP/9M9j2B/gWCRaCMxXVA== - -"@swc/core-linux-x64-musl@1.3.46": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.46.tgz#4ce5b648ce14d11dcae4b1dfcbe60854c992343c" - integrity sha512-WOQZTIkJ9khIj5Z2unf6OTrWV9k8br+HZ93RvnamEmJBlLPUuT9IjB+agNhjaDgOpz9/ZldSGqV7vzl5FGQl1Q== - -"@swc/core-win32-arm64-msvc@1.3.46": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.46.tgz#165a396cf0fba25008f4e458ea30dc28971db9a9" - integrity sha512-4JSREbqaTRQ6QO0EeoiB6G5vuFT8zI8aTOLu5At7Cvlw+X7bOGNO+wJ3Tqw7O+68OL+0bPHzHGTXKL9kUccY1A== - -"@swc/core-win32-ia32-msvc@1.3.46": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.46.tgz#c2522bce504efef73f8d813eb3e1defb4940aaae" - integrity sha512-kC8dIDzcArm1e85yHJsEZFxcNq5NztLkrqkP1nVOQ+9QXD9DKhjbZtWy2gnpclinii6KEGng8SieWiJiOA0CBQ== - -"@swc/core-win32-x64-msvc@1.3.46": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.46.tgz#46fae36cc69b68ee26a41704e1b6a862ea0a8927" - integrity sha512-rrSAfq+DvpJioBxUsnuH+sKl0eXid1DwkwNzkVGHEreN9GoP7GospWtFq7VDcO6DrS/s3HtR4/TzoIYFEBCRIg== - -"@swc/core@^1.3.10": - version "1.3.46" - resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.46.tgz#7c49230113dfcce79b778d4d70e23e93e667350a" - integrity sha512-WxzgJMWUBVJ95HsvEqlWzM3Qxp2FQrPa4QdAkQQuuvCMnfdctGUbhX/c3LiSRlWrl2LIkYAi4bLansTOol4QcQ== - optionalDependencies: - "@swc/core-darwin-arm64" "1.3.46" - "@swc/core-darwin-x64" "1.3.46" - "@swc/core-linux-arm-gnueabihf" "1.3.46" - "@swc/core-linux-arm64-gnu" "1.3.46" - "@swc/core-linux-arm64-musl" "1.3.46" - "@swc/core-linux-x64-gnu" "1.3.46" - "@swc/core-linux-x64-musl" "1.3.46" - "@swc/core-win32-arm64-msvc" "1.3.46" - "@swc/core-win32-ia32-msvc" "1.3.46" - "@swc/core-win32-x64-msvc" "1.3.46" - "@types/cookie@^0.5.1": version "0.5.1" resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.5.1.tgz#b29aa1f91a59f35e29ff8f7cb24faf1a3a750554" @@ -1722,7 +1651,7 @@ chalk@^2.0.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.0.2: +chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -2486,6 +2415,15 @@ fraction.js@^4.2.0: resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.2.0.tgz#448e5109a313a3527f5a3ab2119ec4cf0e0e2950" integrity sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA== +fs-extra@^10.0.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs-extra@^9.0.1: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" @@ -3495,6 +3433,11 @@ nanoid@^3.3.4: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== +narrowing@^1.4.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/narrowing/-/narrowing-1.5.0.tgz#b53c2d1bcec99ae16605ba6b15827f0c7d5d6bbf" + integrity sha512-DUu4XdKgkfAPTAL28k79pdnshDE2W5T24QAnidSPo2F/W1TX6CjNzmEeXQfE5O1lxQvC0GYI6ZRDsLcyzugEYA== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -4737,11 +4680,6 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" - integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== - verror@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" @@ -4764,19 +4702,14 @@ vite-plugin-pwa@^0.14.6: workbox-build "^6.5.4" workbox-window "^6.5.4" -vite-plugin-top-level-await@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/vite-plugin-top-level-await/-/vite-plugin-top-level-await-1.3.0.tgz#83c73b5aed33a3819d85432da27f462218cfb3f5" - integrity sha512-owIfsgWudMlQODWJSwp0sQB3AZZu3qsMygeBjZy8CyjEk6OB9AGd8lHqmgwrcEqgvy9N58lYxSBLVk3/4ejEiA== +vite-plugin-wasm-pack@^0.1.12: + version "0.1.12" + resolved "https://registry.yarnpkg.com/vite-plugin-wasm-pack/-/vite-plugin-wasm-pack-0.1.12.tgz#90f6ca8cd9f8e5e7c9ac98475bc0e5b29f947b0f" + integrity sha512-WliYvQp9HXluir4OKGbngkcKxtYtifU11cqLurRRJGsl770Sjr1iIkp5RuvU3IC1poT4A57Z2/YgAKI2Skm7ZA== dependencies: - "@rollup/plugin-virtual" "^3.0.1" - "@swc/core" "^1.3.10" - uuid "^9.0.0" - -vite-plugin-wasm@^3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/vite-plugin-wasm/-/vite-plugin-wasm-3.2.2.tgz#7a66fef27733a0dea9b2b14f942a6389a2523f7c" - integrity sha512-cdbBUNR850AEoMd5nvLmnyeq63CSfoP1ctD/L2vLk/5+wsgAPlAVAzUK5nGKWO/jtehNlrSSHLteN+gFQw7VOA== + chalk "^4.1.2" + fs-extra "^10.0.0" + narrowing "^1.4.0" vite@^4.1.4: version "4.1.4"