1"use strict"; 2Object.defineProperty(exports, "__esModule", { value: true }); 3exports.getAbsolutePath = exports.createEntryFileAsync = void 0; 4const getDevServer_1 = require("../getDevServer"); 5/** Middleware for creating an entry file in the project. */ 6function createEntryFileAsync() { 7 if (process.env.NODE_ENV === 'production') { 8 // No dev server 9 console.warn('createEntryFile() cannot be used in production'); 10 return; 11 } 12 // Pings middleware in the Expo CLI dev server. 13 return fetch((0, getDevServer_1.getDevServer)().url + '_expo/touch', { 14 method: 'POST', 15 body: JSON.stringify({ 16 contents: TEMPLATE, 17 // Legacy 18 path: './app/index.js', 19 // New 20 absolutePath: getAbsolutePath(), 21 }), 22 }); 23} 24exports.createEntryFileAsync = createEntryFileAsync; 25function getAbsolutePath() { 26 return process.env.EXPO_ROUTER_ABS_APP_ROOT + '/index.js'; 27} 28exports.getAbsolutePath = getAbsolutePath; 29const TEMPLATE = `import { StyleSheet, Text, View } from "react-native"; 30 31export default function Page() { 32 return ( 33 <View style={styles.container}> 34 <View style={styles.main}> 35 <Text style={styles.title}>Hello World</Text> 36 <Text style={styles.subtitle}>This is the first page of your app.</Text> 37 </View> 38 </View> 39 ); 40} 41 42const styles = StyleSheet.create({ 43 container: { 44 flex: 1, 45 alignItems: "center", 46 padding: 24, 47 }, 48 main: { 49 flex: 1, 50 justifyContent: "center", 51 maxWidth: 960, 52 marginHorizontal: "auto", 53 }, 54 title: { 55 fontSize: 64, 56 fontWeight: "bold", 57 }, 58 subtitle: { 59 fontSize: 36, 60 color: "#38434D", 61 }, 62}); 63`; 64//# sourceMappingURL=createEntryFile.js.map