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>
73 lines
2.2 KiB
JavaScript
73 lines
2.2 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
var helperPluginUtils = require('@babel/helper-plugin-utils');
|
|
var core = require('@babel/core');
|
|
|
|
function needsWrapping(node) {
|
|
if (core.types.isLiteral(node) && !core.types.isTemplateLiteral(node)) {
|
|
return false;
|
|
}
|
|
if (core.types.isCallExpression(node) || core.types.isOptionalCallExpression(node) || core.types.isNewExpression(node)) {
|
|
return needsWrapping(node.callee) || node.arguments.some(needsWrapping);
|
|
}
|
|
if (core.types.isTemplateLiteral(node)) {
|
|
return node.expressions.some(needsWrapping);
|
|
}
|
|
if (core.types.isTaggedTemplateExpression(node)) {
|
|
return needsWrapping(node.tag) || needsWrapping(node.quasi);
|
|
}
|
|
if (core.types.isArrayExpression(node)) {
|
|
return node.elements.some(needsWrapping);
|
|
}
|
|
if (core.types.isObjectExpression(node)) {
|
|
return node.properties.some(prop => {
|
|
if (core.types.isObjectProperty(prop)) {
|
|
return needsWrapping(prop.value) || prop.computed && needsWrapping(prop.key);
|
|
}
|
|
if (core.types.isObjectMethod(prop)) {
|
|
return false;
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
if (core.types.isMemberExpression(node) || core.types.isOptionalMemberExpression(node)) {
|
|
return needsWrapping(node.object) || node.computed && needsWrapping(node.property);
|
|
}
|
|
if (core.types.isFunctionExpression(node) || core.types.isArrowFunctionExpression(node) || core.types.isClassExpression(node)) {
|
|
return false;
|
|
}
|
|
if (core.types.isThisExpression(node)) {
|
|
return false;
|
|
}
|
|
if (core.types.isSequenceExpression(node)) {
|
|
return node.expressions.some(needsWrapping);
|
|
}
|
|
return true;
|
|
}
|
|
function wrapInitializer(path) {
|
|
const {
|
|
value
|
|
} = path.node;
|
|
if (value && needsWrapping(value)) {
|
|
path.node.value = core.types.callExpression(core.types.arrowFunctionExpression([], value), []);
|
|
}
|
|
}
|
|
var index = helperPluginUtils.declare(api => {
|
|
api.assertVersion("^7.16.0");
|
|
return {
|
|
name: "plugin-bugfix-safari-class-field-initializer-scope",
|
|
visitor: {
|
|
ClassProperty(path) {
|
|
wrapInitializer(path);
|
|
},
|
|
ClassPrivateProperty(path) {
|
|
wrapInitializer(path);
|
|
}
|
|
}
|
|
};
|
|
});
|
|
|
|
exports.default = index;
|
|
//# sourceMappingURL=index.js.map
|