mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-17 08:42:28 +00:00
progress
This commit is contained in:
1 parent
41b9116c6a
commit
97d597e139
181 files changed
+1970
-2643
No files matched your search
Generated
+8
-3
@@ -15,7 +15,7 @@
|
||||
"chart.js": "^4.5.1",
|
||||
"chartjs-plugin-zoom": "^2.2.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"gpx-rs": "file:../gpx-rs/pkg",
|
||||
"gpx-wasm": "file:../wasm/pkg",
|
||||
"jszip": "^3.10.1",
|
||||
"mapillary-js": "^4.1.2",
|
||||
"maplibre-gl": "^5.21.1",
|
||||
@@ -92,6 +92,11 @@
|
||||
},
|
||||
"../gpx-rs/pkg": {
|
||||
"name": "gpx-rs",
|
||||
"version": "0.1.0",
|
||||
"extraneous": true
|
||||
},
|
||||
"../wasm/pkg": {
|
||||
"name": "gpx-wasm",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
"node_modules/@algolia/abtesting": {
|
||||
@@ -3948,8 +3953,8 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/gpx-rs": {
|
||||
"resolved": "../gpx-rs/pkg",
|
||||
"node_modules/gpx-wasm": {
|
||||
"resolved": "../wasm/pkg",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/graceful-fs": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"chart.js": "^4.5.1",
|
||||
"chartjs-plugin-zoom": "^2.2.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"gpx-rs": "file:../gpx-rs/pkg",
|
||||
"gpx-wasm": "file:../wasm/pkg",
|
||||
"jszip": "^3.10.1",
|
||||
"mapillary-js": "^4.1.2",
|
||||
"maplibre-gl": "^5.21.1",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import type { RouteAttributes, StorageOpened } from 'gpx-rs';
|
||||
import type { RouteAttributes, StorageOpened } from 'gpx-wasm';
|
||||
import type { Backend } from './types';
|
||||
|
||||
/** An array that a command returns as its bytes. */
|
||||
|
||||
@@ -9,13 +9,13 @@ import type {
|
||||
StorageOpened,
|
||||
TrackpointDetails,
|
||||
WaypointDetails,
|
||||
} from 'gpx-rs';
|
||||
} from 'gpx-wasm';
|
||||
import type { MergeType, SelectMode, SplitType } from '../types';
|
||||
|
||||
/**
|
||||
* What the facade needs of the engine of the files, wherever it runs: the WASM module in the
|
||||
* browser (`wasm.ts`), or the Rust process of the desktop app, through its commands (`tauri.ts`).
|
||||
* Both give the same results: see `gpx-rs/wasm` for what each function does.
|
||||
* Both give the same results: see `gpx-rs/src/api` for what each function does.
|
||||
*
|
||||
* Everything is asynchronous, because the desktop app is reached through messages. Ids are
|
||||
* hyphenated UUID strings, the arrays of numbers are typed arrays, and what the functions that
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Backend } from './types';
|
||||
import type { MergeType, SelectMode, SplitType } from '../types';
|
||||
|
||||
type Wasm = typeof import('gpx-rs');
|
||||
type Wasm = typeof import('gpx-wasm');
|
||||
|
||||
/** A call of the module, which is synchronous, as an asynchronous one. */
|
||||
const lift =
|
||||
@@ -21,9 +21,9 @@ function idsToBytes(ids: string[]): Uint8Array {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/** The engine in the page, as the WebAssembly module of `gpx-rs`. */
|
||||
/** The engine in the page, as the WebAssembly module of `wasm`. */
|
||||
export async function createWasmBackend(): Promise<Backend> {
|
||||
const w: Wasm = await import('gpx-rs');
|
||||
const w: Wasm = await import('gpx-wasm');
|
||||
w.start();
|
||||
|
||||
const mode = (m: SelectMode) =>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// The frontend side of the engine, against the real engine (the WASM module of `gpx-rs`, which has
|
||||
// to be built: `wasm-pack build wasm --target bundler --out-dir ../pkg` in `gpx-rs`).
|
||||
// The frontend side of the engine, against the real engine (the WASM module of `wasm`, which has
|
||||
// to be built: `wasm-pack build --target bundler` in `wasm`).
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { beforeEach, describe, it } from 'node:test';
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
|
||||
function fixture(name: string): Uint8Array {
|
||||
return new Uint8Array(
|
||||
readFileSync(new URL(`../../../../gpx-rs/engine/data/${name}.gpx`, import.meta.url))
|
||||
readFileSync(new URL(`../../../../gpx-rs/data/${name}.gpx`, import.meta.url))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
} from '$lib/engine/file-visibility';
|
||||
import { categoryIntervals } from '$lib/engine/trackpoint-categories';
|
||||
import { selectedElementIds, type FileTreeNode } from '$lib/engine/selection-helpers';
|
||||
import type { RouteAttributes } from 'gpx-rs';
|
||||
import type { RouteAttributes } from 'gpx-wasm';
|
||||
import { loadBackend, type Backend } from './backend';
|
||||
import { readFileState } from './file-state';
|
||||
import { StatisticsReader } from './statistics';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import type { FileStructure } from 'gpx-rs';
|
||||
import type { FileStructure } from 'gpx-wasm';
|
||||
import {
|
||||
isHidden,
|
||||
isSegmentHidden,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { FileStructure } from 'gpx-rs';
|
||||
import type { FileStructure } from 'gpx-wasm';
|
||||
|
||||
/**
|
||||
* Visibility the user set explicitly, by element id (file, track, segment, waypoint, or the
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import type { Clipboard, FileStructure, Selection } from 'gpx-rs';
|
||||
import type { Clipboard, FileStructure, Selection } from 'gpx-wasm';
|
||||
import type { VisibilityState } from '$lib/engine/file-visibility';
|
||||
import {
|
||||
elementId,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Clipboard, Selection } from 'gpx-rs';
|
||||
import type { Clipboard, Selection } from 'gpx-wasm';
|
||||
import { isHidden, waypointsKey, type VisibilityState } from '$lib/engine/file-visibility';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { LEGACY_IMPORTED_KEY, readLegacyData } from '$lib/storage/legacy-import';
|
||||
import { parseVisibility, VISIBILITY_KEY, type Visibility } from '$lib/engine/file-visibility';
|
||||
import type { Outcome, StorageOpened } from 'gpx-rs';
|
||||
import type { Outcome, StorageOpened } from 'gpx-wasm';
|
||||
import type { Backend } from './backend';
|
||||
|
||||
/** Name of the IndexedDB database that keeps the files and the settings. */
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Readable } from 'svelte/store';
|
||||
import type { Feature, FeatureCollection, LineString, Point } from 'geojson';
|
||||
import type { Visibility } from '$lib/engine/file-visibility';
|
||||
import type { CategoryIntervals } from '$lib/engine/trackpoint-categories';
|
||||
import type { FileStructure, GlobalStatistics } from 'gpx-rs';
|
||||
import type { FileStructure, GlobalStatistics } from 'gpx-wasm';
|
||||
|
||||
export type {
|
||||
Clipboard,
|
||||
@@ -17,7 +17,7 @@ export type {
|
||||
TrackNode,
|
||||
SegmentNode,
|
||||
WaypointNode,
|
||||
} from 'gpx-rs';
|
||||
} from 'gpx-wasm';
|
||||
|
||||
/**
|
||||
* How a merge puts the selected elements together: `connect` makes a single segment of their
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
*
|
||||
* npm run generate:example
|
||||
*
|
||||
* The engine has to be built (`wasm-pack build wasm --target bundler --out-dir ../pkg`, in
|
||||
* `gpx-rs`).
|
||||
* The engine has to be built (`wasm-pack build --target bundler`, in
|
||||
* `wasm`).
|
||||
*/
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
@@ -16,26 +16,26 @@ import prettier from 'prettier';
|
||||
|
||||
const here = path.dirname(fileURLToPath(import.meta.url));
|
||||
const example = path.resolve(here, '../data/example');
|
||||
const packageDirectory = path.resolve(here, '../../../../gpx-rs/pkg');
|
||||
const packageDirectory = path.resolve(here, '../../../../wasm/pkg');
|
||||
|
||||
export const exampleGPX = path.join(example, 'example.gpx');
|
||||
export const exampleData = path.join(example, 'example-data.ts');
|
||||
|
||||
/** Whether the engine is built. */
|
||||
export function engineIsBuilt() {
|
||||
return fs.existsSync(path.join(packageDirectory, 'gpx_rs_bg.wasm'));
|
||||
return fs.existsSync(path.join(packageDirectory, 'gpx_wasm_bg.wasm'));
|
||||
}
|
||||
|
||||
/** Loads the engine in Node: the package is made for bundlers, which import the wasm file. */
|
||||
async function loadEngine() {
|
||||
const glue = await import(pathToFileURL(path.join(packageDirectory, 'gpx_rs_bg.js')).href);
|
||||
const glue = await import(pathToFileURL(path.join(packageDirectory, 'gpx_wasm_bg.js')).href);
|
||||
const { instance } = await WebAssembly.instantiate(
|
||||
fs.readFileSync(path.join(packageDirectory, 'gpx_rs_bg.wasm')),
|
||||
{ './gpx_rs_bg.js': glue }
|
||||
fs.readFileSync(path.join(packageDirectory, 'gpx_wasm_bg.wasm')),
|
||||
{ './gpx_wasm_bg.js': glue }
|
||||
);
|
||||
glue.__wbg_set_wasm(instance.exports);
|
||||
(instance.exports.__wbindgen_start as () => void)();
|
||||
return glue as typeof import('gpx-rs');
|
||||
return glue as typeof import('gpx-wasm');
|
||||
}
|
||||
|
||||
type Values = Float64Array | BigInt64Array | undefined;
|
||||
|
||||
Reference in new issue
Block a user