- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
82 lines
3.8 KiB
JavaScript
82 lines
3.8 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.expoRouterBabelPlugin = void 0;
|
|
const core_1 = require("@babel/core");
|
|
const path_1 = __importDefault(require("path"));
|
|
const resolve_from_1 = __importDefault(require("resolve-from"));
|
|
const common_1 = require("./common");
|
|
const debug = require('debug')('expo:babel:router');
|
|
function getExpoRouterAppRoot(projectRoot, appFolder) {
|
|
// TODO: We should have cache invalidation if the expo-router/entry file location changes.
|
|
const routerEntry = (0, resolve_from_1.default)(projectRoot, 'expo-router/entry');
|
|
const appRoot = path_1.default.relative(path_1.default.dirname(routerEntry), appFolder);
|
|
debug('routerEntry', routerEntry, appFolder, appRoot);
|
|
return appRoot;
|
|
}
|
|
/**
|
|
* Inlines environment variables to configure the process:
|
|
*
|
|
* EXPO_PROJECT_ROOT
|
|
* EXPO_PUBLIC_USE_STATIC
|
|
* EXPO_ROUTER_ABS_APP_ROOT
|
|
* EXPO_ROUTER_APP_ROOT
|
|
* EXPO_ROUTER_IMPORT_MODE
|
|
*/
|
|
function expoRouterBabelPlugin(api) {
|
|
const { types: t } = api;
|
|
const platform = api.caller(common_1.getPlatform);
|
|
const possibleProjectRoot = api.caller(common_1.getPossibleProjectRoot);
|
|
const asyncRoutes = api.caller(common_1.getAsyncRoutes);
|
|
const routerAbsoluteRoot = api.caller(common_1.getExpoRouterAbsoluteAppRoot);
|
|
function isFirstInAssign(path) {
|
|
return core_1.types.isAssignmentExpression(path.parent) && path.parent.left === path.node;
|
|
}
|
|
return {
|
|
name: 'expo-router',
|
|
visitor: {
|
|
MemberExpression(path, state) {
|
|
const projectRoot = possibleProjectRoot || state.file.opts.root || '';
|
|
if (path.get('object').matchesPattern('process.env')) {
|
|
const key = path.toComputedKey();
|
|
if (t.isStringLiteral(key) && !isFirstInAssign(path)) {
|
|
// Used for log box on web.
|
|
if (key.value.startsWith('EXPO_PROJECT_ROOT')) {
|
|
path.replaceWith(t.stringLiteral(projectRoot));
|
|
}
|
|
else if (
|
|
// TODO: Add cache invalidation.
|
|
key.value.startsWith('EXPO_PUBLIC_USE_STATIC')) {
|
|
if (platform === 'web') {
|
|
const isStatic = process.env.EXPO_PUBLIC_USE_STATIC === 'true' ||
|
|
process.env.EXPO_PUBLIC_USE_STATIC === '1';
|
|
path.replaceWith(t.booleanLiteral(isStatic));
|
|
}
|
|
else {
|
|
path.replaceWith(t.booleanLiteral(false));
|
|
}
|
|
}
|
|
else if (key.value.startsWith('EXPO_ROUTER_IMPORT_MODE')) {
|
|
path.replaceWith(t.stringLiteral(asyncRoutes ? 'lazy' : 'sync'));
|
|
}
|
|
if (
|
|
// Skip loading the app root in tests.
|
|
// This is handled by the testing-library utils
|
|
process.env.NODE_ENV !== 'test') {
|
|
if (key.value.startsWith('EXPO_ROUTER_ABS_APP_ROOT')) {
|
|
path.replaceWith(t.stringLiteral(routerAbsoluteRoot));
|
|
}
|
|
else if (key.value.startsWith('EXPO_ROUTER_APP_ROOT')) {
|
|
path.replaceWith(t.stringLiteral(getExpoRouterAppRoot(projectRoot, routerAbsoluteRoot)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
};
|
|
}
|
|
exports.expoRouterBabelPlugin = expoRouterBabelPlugin;
|