- 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
62 lines
2.8 KiB
JavaScript
62 lines
2.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.environmentRestrictedImportsPlugin = void 0;
|
|
const common_1 = require("./common");
|
|
const FORBIDDEN_CLIENT_IMPORTS = ['server-only'];
|
|
const FORBIDDEN_REACT_SERVER_IMPORTS = ['client-only'];
|
|
/** Prevent importing certain known imports in given environments. This is for sanity to ensure a module never accidentally gets imported unexpectedly. */
|
|
function environmentRestrictedImportsPlugin(api) {
|
|
const { types: t } = api;
|
|
const isReactServer = api.caller(common_1.getIsReactServer);
|
|
const forbiddenPackages = isReactServer
|
|
? FORBIDDEN_REACT_SERVER_IMPORTS
|
|
: FORBIDDEN_CLIENT_IMPORTS;
|
|
function checkSource(source, path) {
|
|
forbiddenPackages.forEach((forbiddenImport) => {
|
|
if (source === forbiddenImport) {
|
|
if (isReactServer) {
|
|
throw path.buildCodeFrameError(`Importing '${forbiddenImport}' module is not allowed in a React server bundle. Add the "use client" directive to this file or one of the parent modules to allow importing this module.`);
|
|
}
|
|
else {
|
|
throw path.buildCodeFrameError(`Importing '${forbiddenImport}' module is not allowed in a client component.`);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return {
|
|
name: 'expo-environment-restricted-imports-plugin',
|
|
visitor: {
|
|
ImportDeclaration(path) {
|
|
checkSource(path.node.source.value, path);
|
|
},
|
|
ExportAllDeclaration(path) {
|
|
if (path.node.source) {
|
|
checkSource(path.node.source.value, path);
|
|
}
|
|
},
|
|
ExportNamedDeclaration(path) {
|
|
if (path.node.source) {
|
|
checkSource(path.node.source.value, path);
|
|
}
|
|
},
|
|
CallExpression(path) {
|
|
if ((('name' in path.node.callee && path.node.callee.name === 'require') ||
|
|
(t.isMemberExpression(path.node.callee) &&
|
|
'name' in path.node.callee.property &&
|
|
['resolveWeak', 'importAll', 'importDefault'].includes(path.node.callee.property.name))) &&
|
|
path.node.arguments.length > 0 &&
|
|
t.isStringLiteral(path.node.arguments[0])) {
|
|
checkSource(path.node.arguments[0].value, path);
|
|
}
|
|
// Handle dynamic import() syntax
|
|
else if (path.node.callee.type === 'Import' &&
|
|
path.node.arguments.length > 0 &&
|
|
t.isStringLiteral(path.node.arguments[0])) {
|
|
checkSource(path.node.arguments[0].value, path);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
}
|
|
exports.environmentRestrictedImportsPlugin = environmentRestrictedImportsPlugin;
|