Files
Eric FELIXINE e30ae8ed09 feat(smart-app): implement complete mobile app MVP
- 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
2026-06-01 18:00:35 -04:00

218 lines
7.9 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.assertInternalProjectRoot = assertInternalProjectRoot;
exports.moduleNameIsDirectFileReference = moduleNameIsDirectFileReference;
exports.normalizeStaticPlugin = normalizeStaticPlugin;
exports.pluginFileName = void 0;
exports.resolveConfigPluginExport = resolveConfigPluginExport;
exports.resolveConfigPluginFunction = resolveConfigPluginFunction;
exports.resolveConfigPluginFunctionWithInfo = resolveConfigPluginFunctionWithInfo;
exports.resolvePluginForModule = resolvePluginForModule;
function _assert() {
const data = _interopRequireDefault(require("assert"));
_assert = function () {
return data;
};
return data;
}
function _findUp() {
const data = _interopRequireDefault(require("find-up"));
_findUp = function () {
return data;
};
return data;
}
function path() {
const data = _interopRequireWildcard(require("path"));
path = function () {
return data;
};
return data;
}
function _resolveFrom() {
const data = _interopRequireDefault(require("resolve-from"));
_resolveFrom = function () {
return data;
};
return data;
}
function _errors() {
const data = require("./errors");
_errors = function () {
return data;
};
return data;
}
function _modules() {
const data = require("./modules");
_modules = function () {
return data;
};
return data;
}
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Default plugin entry file name.
const pluginFileName = exports.pluginFileName = 'app.plugin.js';
function findUpPackageJson(root) {
const packageJson = _findUp().default.sync('package.json', {
cwd: root
});
(0, _assert().default)(packageJson, `No package.json found for module "${root}"`);
return packageJson;
}
function resolvePluginForModule(projectRoot, modulePath) {
const resolved = _resolveFrom().default.silent(projectRoot, modulePath);
if (!resolved) {
throw new (_errors().PluginError)(`Failed to resolve plugin for module "${modulePath}" relative to "${projectRoot}"`, 'PLUGIN_NOT_FOUND');
}
// If the modulePath is something like `@bacon/package/index.js` or `expo-foo/build/app`
// then skip resolving the module `app.plugin.js`
if (moduleNameIsDirectFileReference(modulePath)) {
return {
isPluginFile: false,
filePath: resolved
};
}
return findUpPlugin(resolved);
}
// TODO: Test windows
function pathIsFilePath(name) {
// Matches lines starting with: . / ~/
return !!name.match(/^(\.|~\/|\/)/g);
}
function moduleNameIsDirectFileReference(name) {
if (pathIsFilePath(name)) {
return true;
}
const slashCount = name.split(path().sep)?.length;
// Orgs (like @expo/config ) should have more than one slash to be a direct file.
if (name.startsWith('@')) {
return slashCount > 2;
}
// Regular packages should be considered direct reference if they have more than one slash.
return slashCount > 1;
}
function resolveExpoPluginFile(root) {
// Find the expo plugin root file
const pluginModuleFile = _resolveFrom().default.silent(root,
// use ./ so it isn't resolved as a node module
`./${pluginFileName}`);
// If the default expo plugin file exists use it.
if (pluginModuleFile && (0, _modules().fileExists)(pluginModuleFile)) {
return pluginModuleFile;
}
return null;
}
function findUpPlugin(root) {
// Get the closest package.json to the node module
const packageJson = findUpPackageJson(root);
// resolve the root folder for the node module
const moduleRoot = path().dirname(packageJson);
// use whatever the initial resolved file was ex: `node_modules/my-package/index.js` or `./something.js`
const pluginFile = resolveExpoPluginFile(moduleRoot);
return {
filePath: pluginFile ?? root,
isPluginFile: !!pluginFile
};
}
function normalizeStaticPlugin(plugin) {
if (Array.isArray(plugin)) {
(0, _assert().default)(plugin.length > 0 && plugin.length < 3, `Wrong number of arguments provided for static config plugin, expected either 1 or 2, got ${plugin.length}`);
return plugin;
}
return [plugin, undefined];
}
function assertInternalProjectRoot(projectRoot) {
(0, _assert().default)(projectRoot, `Unexpected: Config \`_internal.projectRoot\` isn't defined by expo-cli, this is a bug.`);
}
// Resolve the module function and assert type
function resolveConfigPluginFunction(projectRoot, pluginReference) {
const {
plugin
} = resolveConfigPluginFunctionWithInfo(projectRoot, pluginReference);
return plugin;
}
// Resolve the module function and assert type
function resolveConfigPluginFunctionWithInfo(projectRoot, pluginReference) {
const {
filePath: pluginFile,
isPluginFile
} = resolvePluginForModule(projectRoot, pluginReference);
let result;
try {
result = requirePluginFile(pluginFile);
} catch (error) {
if (error instanceof SyntaxError) {
const learnMoreLink = `Learn more: https://docs.expo.dev/guides/config-plugins/#creating-a-plugin`;
// If the plugin reference is a node module, and that node module has a syntax error, then it probably doesn't have an official config plugin.
if (!isPluginFile && !moduleNameIsDirectFileReference(pluginReference)) {
const pluginError = new (_errors().PluginError)(`Package "${pluginReference}" does not contain a valid config plugin.\n${learnMoreLink}\n\n${error.message}`, 'INVALID_PLUGIN_IMPORT');
pluginError.stack = error.stack;
throw pluginError;
}
}
throw error;
}
const plugin = resolveConfigPluginExport({
plugin: result,
pluginFile,
pluginReference,
isPluginFile
});
return {
plugin,
pluginFile,
pluginReference,
isPluginFile
};
}
/**
* - Resolve the exported contents of an Expo config (be it default or module.exports)
* - Assert no promise exports
* - Return config type
* - Serialize config
*
* @param props.plugin plugin results
* @param props.pluginFile plugin file path
* @param props.pluginReference the string used to reference the plugin
* @param props.isPluginFile is file path from the app.plugin.js module root
*/
function resolveConfigPluginExport({
plugin,
pluginFile,
pluginReference,
isPluginFile
}) {
if (plugin.default != null) {
plugin = plugin.default;
}
if (typeof plugin !== 'function') {
const learnMoreLink = `Learn more: https://docs.expo.dev/guides/config-plugins/#creating-a-plugin`;
// If the plugin reference is a node module, and that node module does not export a function then it probably doesn't have a config plugin.
if (!isPluginFile && !moduleNameIsDirectFileReference(pluginReference)) {
throw new (_errors().PluginError)(`Package "${pluginReference}" does not contain a valid config plugin. Module must export a function from file: ${pluginFile}\n${learnMoreLink}`, 'INVALID_PLUGIN_TYPE');
}
throw new (_errors().PluginError)(`Plugin "${pluginReference}" must export a function from file: ${pluginFile}. ${learnMoreLink}`, 'INVALID_PLUGIN_TYPE');
}
return plugin;
}
function requirePluginFile(filePath) {
try {
return require(filePath);
} catch (error) {
// TODO: Improve error messages
throw error;
}
}
//# sourceMappingURL=plugin-resolver.js.map