Revert "Add wasm directly"

This reverts commit a8019d4bf8.
This commit is contained in:
Austen Adler 2023-04-17 19:41:28 -04:00
parent 710141fba3
commit 18a3faf2e4
7 changed files with 39 additions and 129 deletions

View File

@ -1,5 +1,4 @@
/src/lib/docs/* /src/lib/docs/*
/src/lib/pkg/*
.DS_Store .DS_Store
node_modules node_modules

View File

@ -32,8 +32,7 @@
"typescript": "^4.9.3", "typescript": "^4.9.3",
"vite": "^4.1.4", "vite": "^4.1.4",
"vite-plugin-pwa": "^0.14.6", "vite-plugin-pwa": "^0.14.6",
"vite-plugin-top-level-await": "^1.3.0", "vite-plugin-wasm-pack": "^0.1.12"
"vite-plugin-wasm": "^3.2.2"
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {

View File

@ -1,9 +1,5 @@
// import init from 'xpin-wasm'; import init from 'xpin-wasm';
// import * as xpinWasm 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';
export const WasmStatus = { export const WasmStatus = {
NotLoaded: -1, NotLoaded: -1,
@ -15,18 +11,16 @@ export async function getWasm() {
let wasmStatus = WasmStatus.NotLoaded; let wasmStatus = WasmStatus.NotLoaded;
let wasmError; let wasmError;
await init()
.then(() => {
wasmStatus = WasmStatus.Loaded; wasmStatus = WasmStatus.Loaded;
})
// await init() .catch((e) => {
// .then(() => { console.error('Error loading wasm module', e);
wasmError = e;
// }) wasmStatus = WasmStatus.Errored;
// .catch((e) => { throw e;
// console.error('Error loading wasm module', e); });
// wasmError = e;
// wasmStatus = WasmStatus.Errored;
// throw e;
// });
return { return {
status: wasmStatus, status: wasmStatus,

View File

@ -1 +0,0 @@
../../../xpin-wasm/pkg/

View File

@ -4,16 +4,7 @@
export let xpin; export let xpin;
let formats = ['dd', 'dms', 'dmm', 'utm', 'plus']; let formats = ['dd', 'dms', 'dmm', 'utm', 'plus'];
let urlFormats = [ let urlFormats = ['google_maps', 'geo', 'openstreetmap', 'waze', 'apple_maps', 'osmand', 'bing_maps', 'osmand_direct'];
'google_maps',
'geo',
'openstreetmap',
'waze',
'apple_maps',
'osmand',
'bing_maps',
'osmand_direct'
];
onMount(() => { onMount(() => {
// TODO: Indicate that the data is copied // TODO: Indicate that the data is copied

View File

@ -1,20 +1,15 @@
import { sveltekit } from '@sveltejs/kit/vite'; import { sveltekit } from '@sveltejs/kit/vite';
import { SvelteKitPWA } from '@vite-pwa/sveltekit'; import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import wasmPack from 'vite-plugin-wasm-pack';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [sveltekit(), wasmPack('../xpin-wasm/'), SvelteKitPWA({
sveltekit(), SvelteKitPWA({
workbox: { workbox: {
globPatterns: ['**/*.{js,html,wasm}'], globPatterns: ['**/*.{js,html,wasm}'],
}, },
devOptions: { devOptions: {
enabled: true, enabled: true,
}, },
}), })]
wasm(),
topLevelAwait(),
]
}); });

View File

@ -1178,11 +1178,6 @@
"@rollup/pluginutils" "^5.0.1" "@rollup/pluginutils" "^5.0.1"
magic-string "^0.27.0" 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": "@rollup/pluginutils@^3.1.0":
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
@ -1254,72 +1249,6 @@
svelte-hmr "^0.15.1" svelte-hmr "^0.15.1"
vitefu "^0.2.4" 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": "@types/cookie@^0.5.1":
version "0.5.1" version "0.5.1"
resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.5.1.tgz#b29aa1f91a59f35e29ff8f7cb24faf1a3a750554" 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" escape-string-regexp "^1.0.5"
supports-color "^5.3.0" 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" version "4.1.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== 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" resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.2.0.tgz#448e5109a313a3527f5a3ab2119ec4cf0e0e2950"
integrity sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA== 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: fs-extra@^9.0.1:
version "9.1.0" version "9.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" 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" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== 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: natural-compare@^1.4.0:
version "1.4.0" version "1.4.0"
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" 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" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== 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: verror@1.10.0:
version "1.10.0" version "1.10.0"
resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" 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-build "^6.5.4"
workbox-window "^6.5.4" workbox-window "^6.5.4"
vite-plugin-top-level-await@^1.3.0: vite-plugin-wasm-pack@^0.1.12:
version "1.3.0" version "0.1.12"
resolved "https://registry.yarnpkg.com/vite-plugin-top-level-await/-/vite-plugin-top-level-await-1.3.0.tgz#83c73b5aed33a3819d85432da27f462218cfb3f5" resolved "https://registry.yarnpkg.com/vite-plugin-wasm-pack/-/vite-plugin-wasm-pack-0.1.12.tgz#90f6ca8cd9f8e5e7c9ac98475bc0e5b29f947b0f"
integrity sha512-owIfsgWudMlQODWJSwp0sQB3AZZu3qsMygeBjZy8CyjEk6OB9AGd8lHqmgwrcEqgvy9N58lYxSBLVk3/4ejEiA== integrity sha512-WliYvQp9HXluir4OKGbngkcKxtYtifU11cqLurRRJGsl770Sjr1iIkp5RuvU3IC1poT4A57Z2/YgAKI2Skm7ZA==
dependencies: dependencies:
"@rollup/plugin-virtual" "^3.0.1" chalk "^4.1.2"
"@swc/core" "^1.3.10" fs-extra "^10.0.0"
uuid "^9.0.0" narrowing "^1.4.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==
vite@^4.1.4: vite@^4.1.4:
version "4.1.4" version "4.1.4"