wasm first steps

This commit is contained in:
vcoppe
2026-07-14 18:36:30 +02:00
parent 86f4fc3394
commit ed6264444f
11 changed files with 398 additions and 3 deletions
+21 -1
View File
@@ -17,6 +17,7 @@
"dexie": "^4.0.11",
"file-saver": "^2.0.5",
"gpx": "file:../gpx",
"gpx-rs": "file:../gpx-rs/pkg",
"immer": "^10.1.1",
"jszip": "^3.10.1",
"mapillary-js": "^4.1.2",
@@ -70,7 +71,8 @@
"tw-animate-css": "^1.4.0",
"typescript": "^5.8.3",
"vaul-svelte": "^1.0.0-next.7",
"vite": "^6.3.5"
"vite": "^6.3.5",
"vite-plugin-wasm": "^3.6.0"
}
},
"../gpx": {
@@ -89,6 +91,10 @@
"typescript": "^5.6.2"
}
},
"../gpx-rs/pkg": {
"name": "gpx-rs",
"version": "0.1.0"
},
"../gpx/node_modules/@cspotcode/source-map-support": {
"version": "0.8.1",
"dev": true,
@@ -5492,6 +5498,10 @@
"resolved": "../gpx",
"link": true
},
"node_modules/gpx-rs": {
"resolved": "../gpx-rs/pkg",
"link": true
},
"node_modules/graceful-fs": {
"version": "4.2.11",
"dev": true,
@@ -7716,6 +7726,16 @@
"node": ">=18.0.0"
}
},
"node_modules/vite-plugin-wasm": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/vite-plugin-wasm/-/vite-plugin-wasm-3.6.0.tgz",
"integrity": "sha512-mL/QPziiIA4RAA6DkaZZzOstdwbW5jO4Vz7Zenj0wieKWBlNvIvX5L5ljum9lcUX0ShNfBgCNLKTjNkRVVqcsw==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"vite": "^2 || ^3 || ^4 || ^5 || ^6 || ^7 || ^8"
}
},
"node_modules/vite/node_modules/@esbuild/aix-ppc64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
+3 -1
View File
@@ -59,7 +59,8 @@
"tw-animate-css": "^1.4.0",
"typescript": "^5.8.3",
"vaul-svelte": "^1.0.0-next.7",
"vite": "^6.3.5"
"vite": "^6.3.5",
"vite-plugin-wasm": "^3.6.0"
},
"type": "module",
"dependencies": {
@@ -72,6 +73,7 @@
"dexie": "^4.0.11",
"file-saver": "^2.0.5",
"gpx": "file:../gpx",
"gpx-rs": "file:../gpx-rs/pkg",
"immer": "^10.1.1",
"jszip": "^3.10.1",
"mapillary-js": "^4.1.2",
@@ -20,6 +20,7 @@
import { getURLForGoogleDriveFile } from '$lib/components/embedding/embedding';
import { db } from '$lib/db';
import { fileStateCollection } from '$lib/logic/file-state';
import { browser } from '$app/environment';
const {
treeFileView,
@@ -36,6 +37,14 @@
);
onMount(async () => {
if (browser) {
const wasm = await import('gpx-rs');
const controller = new wasm.Controller();
console.log(controller);
controller.create_file();
}
settings.connectToDatabase(db);
fileStateCollection.connectToDatabase(db).then(() => {
let files: string[] = JSON.parse(page.url.searchParams.get('files') || '[]');
+2 -1
View File
@@ -2,10 +2,11 @@ import { sveltekit } from '@sveltejs/kit/vite';
import { enhancedImages } from '@sveltejs/enhanced-img';
import { defineConfig } from 'vite';
import tailwindcss from '@tailwindcss/vite';
import wasm from 'vite-plugin-wasm';
export default defineConfig({
ssr: {
noExternal: ['gpx'],
},
plugins: [enhancedImages(), tailwindcss(), sveltekit()],
plugins: [enhancedImages(), tailwindcss(), wasm(), sveltekit()],
});