1"use strict"; 2var __importDefault = (this && this.__importDefault) || function (mod) { 3 return (mod && mod.__esModule) ? mod : { "default": mod }; 4}; 5Object.defineProperty(exports, "__esModule", { value: true }); 6const config_plugins_1 = require("@expo/config-plugins"); 7// @ts-expect-error missing types 8const app_plugin_1 = __importDefault(require("expo-dev-launcher/app.plugin")); 9// @ts-expect-error missing types 10const app_plugin_2 = __importDefault(require("expo-dev-menu/app.plugin")); 11const fs_1 = __importDefault(require("fs")); 12const path_1 = __importDefault(require("path")); 13const pkg = require('expo-dev-client/package.json'); 14const REACT_NATIVE_CONFIG_JS = `// File created by expo-dev-client/app.plugin.js 15 16module.exports = { 17 dependencies: { 18 ...require('expo-dev-client/dependencies'), 19 }, 20}; 21`; 22function withReactNativeConfigJs(config) { 23 return config_plugins_1.withDangerousMod(config, [ 24 'ios', 25 async (config) => { 26 const filename = path_1.default.join(config.modRequest.projectRoot, 'react-native.config.js'); 27 try { 28 const config = fs_1.default.readFileSync(filename, 'utf8'); 29 if (!config.includes('expo-dev-client/dependencies')) { 30 throw new Error(`Could not add expo-dev-client dependencies to existing file ${filename}. See expo-dev-client installation instructions to add them manually.`); 31 } 32 } 33 catch (error) { 34 if (error.code === 'ENOENT') { 35 // The file doesn't exist, so we create it. 36 fs_1.default.writeFileSync(filename, REACT_NATIVE_CONFIG_JS); 37 } 38 else { 39 throw error; 40 } 41 } 42 return config; 43 }, 44 ]); 45} 46function withDevClient(config) { 47 config = app_plugin_2.default(config); 48 config = app_plugin_1.default(config); 49 config = withReactNativeConfigJs(config); 50 return config; 51} 52exports.default = config_plugins_1.createRunOncePlugin(withDevClient, pkg.name, pkg.version); 53