- 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
89 lines
2.1 KiB
JavaScript
89 lines
2.1 KiB
JavaScript
import * as pirates from "pirates";
|
|
|
|
import { transform} from "./index";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function addHook(
|
|
extension,
|
|
sucraseOptions,
|
|
hookOptions,
|
|
) {
|
|
let mergedSucraseOptions = sucraseOptions;
|
|
const sucraseOptionsEnvJSON = process.env.SUCRASE_OPTIONS;
|
|
if (sucraseOptionsEnvJSON) {
|
|
mergedSucraseOptions = {...mergedSucraseOptions, ...JSON.parse(sucraseOptionsEnvJSON)};
|
|
}
|
|
return pirates.addHook(
|
|
(code, filePath) => {
|
|
const {code: transformedCode, sourceMap} = transform(code, {
|
|
...mergedSucraseOptions,
|
|
sourceMapOptions: {compiledFilename: filePath},
|
|
filePath,
|
|
});
|
|
const mapBase64 = Buffer.from(JSON.stringify(sourceMap)).toString("base64");
|
|
const suffix = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${mapBase64}`;
|
|
return `${transformedCode}\n${suffix}`;
|
|
},
|
|
{...hookOptions, exts: [extension]},
|
|
);
|
|
}
|
|
|
|
export function registerJS(hookOptions) {
|
|
return addHook(".js", {transforms: ["imports", "flow", "jsx"]}, hookOptions);
|
|
}
|
|
|
|
export function registerJSX(hookOptions) {
|
|
return addHook(".jsx", {transforms: ["imports", "flow", "jsx"]}, hookOptions);
|
|
}
|
|
|
|
export function registerTS(hookOptions) {
|
|
return addHook(".ts", {transforms: ["imports", "typescript"]}, hookOptions);
|
|
}
|
|
|
|
export function registerTSX(hookOptions) {
|
|
return addHook(".tsx", {transforms: ["imports", "typescript", "jsx"]}, hookOptions);
|
|
}
|
|
|
|
export function registerTSLegacyModuleInterop(hookOptions) {
|
|
return addHook(
|
|
".ts",
|
|
{
|
|
transforms: ["imports", "typescript"],
|
|
enableLegacyTypeScriptModuleInterop: true,
|
|
},
|
|
hookOptions,
|
|
);
|
|
}
|
|
|
|
export function registerTSXLegacyModuleInterop(hookOptions) {
|
|
return addHook(
|
|
".tsx",
|
|
{
|
|
transforms: ["imports", "typescript", "jsx"],
|
|
enableLegacyTypeScriptModuleInterop: true,
|
|
},
|
|
hookOptions,
|
|
);
|
|
}
|
|
|
|
export function registerAll(hookOptions) {
|
|
const reverts = [
|
|
registerJS(hookOptions),
|
|
registerJSX(hookOptions),
|
|
registerTS(hookOptions),
|
|
registerTSX(hookOptions),
|
|
];
|
|
|
|
return () => {
|
|
for (const fn of reverts) {
|
|
fn();
|
|
}
|
|
};
|
|
}
|