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
113
pwa/node_modules/tempy/index.d.ts
generated
vendored
Normal file
113
pwa/node_modules/tempy/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
/// <reference types="node"/>
|
||||
import {MergeExclusive, TypedArray} from 'type-fest';
|
||||
|
||||
declare namespace tempy {
|
||||
type FileOptions = MergeExclusive<
|
||||
{
|
||||
/**
|
||||
File extension.
|
||||
|
||||
Mutually exclusive with the `name` option.
|
||||
|
||||
_You usually won't need this option. Specify it only when actually needed._
|
||||
*/
|
||||
readonly extension?: string;
|
||||
},
|
||||
{
|
||||
/**
|
||||
Filename.
|
||||
|
||||
Mutually exclusive with the `extension` option.
|
||||
|
||||
_You usually won't need this option. Specify it only when actually needed._
|
||||
*/
|
||||
readonly name?: string;
|
||||
}
|
||||
>;
|
||||
|
||||
type DirectoryOptions = {
|
||||
/**
|
||||
_You usually won't need this option. Specify it only when actually needed._
|
||||
|
||||
Directory prefix.
|
||||
|
||||
Useful for testing by making it easier to identify cache directories that are created.
|
||||
*/
|
||||
readonly prefix?: string;
|
||||
};
|
||||
}
|
||||
|
||||
declare const tempy: {
|
||||
/**
|
||||
Get a temporary file path you can write to.
|
||||
|
||||
@example
|
||||
```
|
||||
import tempy = require('tempy');
|
||||
|
||||
tempy.file();
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/4f504b9edb5ba0e89451617bf9f971dd'
|
||||
|
||||
tempy.file({extension: 'png'});
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/a9fb0decd08179eb6cf4691568aa2018.png'
|
||||
|
||||
tempy.file({name: 'unicorn.png'});
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/f7f62bfd4e2a05f1589947647ed3f9ec/unicorn.png'
|
||||
|
||||
tempy.directory();
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
|
||||
```
|
||||
*/
|
||||
file: (options?: tempy.FileOptions) => string;
|
||||
|
||||
/**
|
||||
Get a temporary directory path. The directory is created for you.
|
||||
|
||||
@example
|
||||
```
|
||||
import tempy = require('tempy');
|
||||
|
||||
tempy.directory();
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
|
||||
|
||||
tempy.directory({prefix: 'a'});
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/name_3c085674ad31223b9653c88f725d6b41'
|
||||
```
|
||||
*/
|
||||
directory: (options?: tempy.DirectoryOptions) => string;
|
||||
|
||||
/**
|
||||
Write data to a random temp file.
|
||||
|
||||
@example
|
||||
```
|
||||
import tempy = require('tempy');
|
||||
|
||||
await tempy.write('🦄');
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
|
||||
```
|
||||
*/
|
||||
write: (fileContent: string | Buffer | TypedArray | DataView | NodeJS.ReadableStream, options?: tempy.FileOptions) => Promise<string>;
|
||||
|
||||
/**
|
||||
Synchronously write data to a random temp file.
|
||||
|
||||
@example
|
||||
```
|
||||
import tempy = require('tempy');
|
||||
|
||||
tempy.writeSync('🦄');
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
|
||||
```
|
||||
*/
|
||||
writeSync: (fileContent: string | Buffer | TypedArray | DataView, options?: tempy.FileOptions) => string;
|
||||
|
||||
/**
|
||||
Get the root temporary directory path.
|
||||
|
||||
For example: `/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T`.
|
||||
*/
|
||||
readonly root: string;
|
||||
};
|
||||
|
||||
export = tempy;
|
||||
56
pwa/node_modules/tempy/index.js
generated
vendored
Normal file
56
pwa/node_modules/tempy/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const uniqueString = require('unique-string');
|
||||
const tempDir = require('temp-dir');
|
||||
const isStream = require('is-stream');
|
||||
const stream = require('stream');
|
||||
const {promisify} = require('util');
|
||||
|
||||
const pipeline = promisify(stream.pipeline);
|
||||
const {writeFile} = fs.promises;
|
||||
|
||||
const getPath = (prefix = '') => path.join(tempDir, prefix + uniqueString());
|
||||
|
||||
const writeStream = async (filePath, data) => pipeline(data, fs.createWriteStream(filePath));
|
||||
|
||||
module.exports.file = options => {
|
||||
options = {
|
||||
...options
|
||||
};
|
||||
|
||||
if (options.name) {
|
||||
if (options.extension !== undefined && options.extension !== null) {
|
||||
throw new Error('The `name` and `extension` options are mutually exclusive');
|
||||
}
|
||||
|
||||
return path.join(module.exports.directory(), options.name);
|
||||
}
|
||||
|
||||
return getPath() + (options.extension === undefined || options.extension === null ? '' : '.' + options.extension.replace(/^\./, ''));
|
||||
};
|
||||
|
||||
module.exports.directory = ({prefix = ''} = {}) => {
|
||||
const directory = getPath(prefix);
|
||||
fs.mkdirSync(directory);
|
||||
return directory;
|
||||
};
|
||||
|
||||
module.exports.write = async (data, options) => {
|
||||
const filename = module.exports.file(options);
|
||||
const write = isStream(data) ? writeStream : writeFile;
|
||||
await write(filename, data);
|
||||
return filename;
|
||||
};
|
||||
|
||||
module.exports.writeSync = (data, options) => {
|
||||
const filename = module.exports.file(options);
|
||||
fs.writeFileSync(filename, data);
|
||||
return filename;
|
||||
};
|
||||
|
||||
Object.defineProperty(module.exports, 'root', {
|
||||
get() {
|
||||
return tempDir;
|
||||
}
|
||||
});
|
||||
9
pwa/node_modules/tempy/license
generated
vendored
Normal file
9
pwa/node_modules/tempy/license
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
53
pwa/node_modules/tempy/package.json
generated
vendored
Normal file
53
pwa/node_modules/tempy/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"name": "tempy",
|
||||
"version": "0.6.0",
|
||||
"description": "Get a random temporary file or directory path",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/tempy",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"temp",
|
||||
"temporary",
|
||||
"path",
|
||||
"file",
|
||||
"directory",
|
||||
"folder",
|
||||
"tempfile",
|
||||
"tempdir",
|
||||
"tmpdir",
|
||||
"tmpfile",
|
||||
"random",
|
||||
"unique"
|
||||
],
|
||||
"dependencies": {
|
||||
"is-stream": "^2.0.0",
|
||||
"temp-dir": "^2.0.0",
|
||||
"type-fest": "^0.16.0",
|
||||
"unique-string": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"tsd": "^0.13.1",
|
||||
"xo": "^0.32.1"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"node/no-unsupported-features/node-builtins": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
111
pwa/node_modules/tempy/readme.md
generated
vendored
Normal file
111
pwa/node_modules/tempy/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
# tempy [](https://travis-ci.com/github/sindresorhus/tempy)
|
||||
|
||||
> Get a random temporary file or directory path
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install tempy
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const tempy = require('tempy');
|
||||
|
||||
tempy.file();
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/4f504b9edb5ba0e89451617bf9f971dd'
|
||||
|
||||
tempy.file({extension: 'png'});
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/a9fb0decd08179eb6cf4691568aa2018.png'
|
||||
|
||||
tempy.file({name: 'unicorn.png'});
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/f7f62bfd4e2a05f1589947647ed3f9ec/unicorn.png'
|
||||
|
||||
tempy.directory();
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
|
||||
|
||||
tempy.directory({prefix: 'name'});
|
||||
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/name_3c085674ad31223b9653c88f725d6b41'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### tempy.file(options?)
|
||||
|
||||
Get a temporary file path you can write to.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
*You usually won't need either the `extension` or `name` option. Specify them only when actually needed.*
|
||||
|
||||
##### extension
|
||||
|
||||
Type: `string`
|
||||
|
||||
File extension.
|
||||
|
||||
##### name
|
||||
|
||||
Type: `string`
|
||||
|
||||
Filename. Mutually exclusive with the `extension` option.
|
||||
|
||||
### tempy.directory([options])
|
||||
|
||||
Get a temporary directory path. The directory is created for you.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### prefix
|
||||
|
||||
|
||||
Type: `string`
|
||||
|
||||
Directory prefix.
|
||||
|
||||
Useful for testing by making it easier to identify cache directories that are created.
|
||||
|
||||
*You usually won't need this option. Specify it only when actually needed.*
|
||||
|
||||
### tempy.write(fileContent, options?)
|
||||
|
||||
Write data to a random temp file.
|
||||
|
||||
##### fileContent
|
||||
|
||||
Type: `string | Buffer | TypedArray | DataView | stream.Readable`
|
||||
|
||||
Data to write to the temp file.
|
||||
|
||||
##### options
|
||||
|
||||
See [options](#options).
|
||||
|
||||
### tempy.writeSync(fileContent, options?)
|
||||
|
||||
Synchronously write data to a random temp file.
|
||||
|
||||
##### fileContent
|
||||
|
||||
Type: `string | Buffer | TypedArray | DataView`
|
||||
|
||||
Data to write to the temp file.
|
||||
|
||||
##### options
|
||||
|
||||
See [options](#options).
|
||||
|
||||
### tempy.root
|
||||
|
||||
Get the root temporary directory path. For example: `/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T`
|
||||
|
||||
## FAQ
|
||||
|
||||
#### Why doesn't it have a cleanup method?
|
||||
|
||||
Temp files will be periodically cleaned up on macOS. Most Linux distros will clean up on reboot. If you're generating a lot of temp files, it's recommended to use a complementary module like [`del`](https://github.com/sindresorhus/del) for cleanup.
|
||||
Loading…
Add table
Add a link
Reference in a new issue