Add progressive web app companion for cross-platform access
Vite + TypeScript PWA that mirrors the Android app's core features: - Pre-processed shelter data (build-time UTM33N→WGS84 conversion) - Leaflet map with shelter markers, user location, and offline tiles - Canvas compass arrow (ported from DirectionArrowView.kt) - IndexedDB shelter cache with 7-day staleness check - Service worker with CacheFirst tiles and precached app shell - i18n for en, nb, nn (ported from Android strings.xml) - iOS/Android compass handling with low-pass filter - Respects user map interaction (no auto-snap on pan/zoom) - Build revision cache-breaker for reliable SW updates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
46365b713b
commit
e8428de775
12051 changed files with 1799735 additions and 0 deletions
70
pwa/node_modules/vitest/dist/chunks/setup-common.Dj6BZI3u.js
generated
vendored
Normal file
70
pwa/node_modules/vitest/dist/chunks/setup-common.Dj6BZI3u.js
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
import { addSerializer } from '@vitest/snapshot';
|
||||
import { setSafeTimers } from '@vitest/utils';
|
||||
import { r as resetRunOnceCounter } from './run-once.2ogXb3JV.js';
|
||||
|
||||
let globalSetup = false;
|
||||
async function setupCommonEnv(config) {
|
||||
resetRunOnceCounter();
|
||||
setupDefines(config.defines);
|
||||
setupEnv(config.env);
|
||||
if (globalSetup) {
|
||||
return;
|
||||
}
|
||||
globalSetup = true;
|
||||
setSafeTimers();
|
||||
if (config.globals) {
|
||||
(await import('./globals.D8ZVAdXd.js')).registerApiGlobally();
|
||||
}
|
||||
}
|
||||
function setupDefines(defines) {
|
||||
for (const key in defines) {
|
||||
globalThis[key] = defines[key];
|
||||
}
|
||||
}
|
||||
function setupEnv(env) {
|
||||
if (typeof process === "undefined") {
|
||||
return;
|
||||
}
|
||||
const { PROD, DEV, ...restEnvs } = env;
|
||||
process.env.PROD = PROD ? "1" : "";
|
||||
process.env.DEV = DEV ? "1" : "";
|
||||
for (const key in restEnvs) {
|
||||
process.env[key] = env[key];
|
||||
}
|
||||
}
|
||||
async function loadDiffConfig(config, executor) {
|
||||
if (typeof config.diff !== "string") {
|
||||
return;
|
||||
}
|
||||
const diffModule = await executor.executeId(config.diff);
|
||||
if (diffModule && typeof diffModule.default === "object" && diffModule.default != null) {
|
||||
return diffModule.default;
|
||||
} else {
|
||||
throw new Error(
|
||||
`invalid diff config file ${config.diff}. Must have a default export with config object`
|
||||
);
|
||||
}
|
||||
}
|
||||
async function loadSnapshotSerializers(config, executor) {
|
||||
const files = config.snapshotSerializers;
|
||||
const snapshotSerializers = await Promise.all(
|
||||
files.map(async (file) => {
|
||||
const mo = await executor.executeId(file);
|
||||
if (!mo || typeof mo.default !== "object" || mo.default === null) {
|
||||
throw new Error(
|
||||
`invalid snapshot serializer file ${file}. Must export a default object`
|
||||
);
|
||||
}
|
||||
const config2 = mo.default;
|
||||
if (typeof config2.test !== "function" || typeof config2.serialize !== "function" && typeof config2.print !== "function") {
|
||||
throw new TypeError(
|
||||
`invalid snapshot serializer in ${file}. Must have a 'test' method along with either a 'serialize' or 'print' method.`
|
||||
);
|
||||
}
|
||||
return config2;
|
||||
})
|
||||
);
|
||||
snapshotSerializers.forEach((serializer) => addSerializer(serializer));
|
||||
}
|
||||
|
||||
export { loadSnapshotSerializers as a, loadDiffConfig as l, setupCommonEnv as s };
|
||||
Loading…
Add table
Add a link
Reference in a new issue