1 line
3.0 KiB
Plaintext
1 line
3.0 KiB
Plaintext
|
{"version":3,"sources":["../src/getConfig.ts"],"names":["readConfigFile","configFile","context","error","isConfigError","message","getDynamicConfig","configPath","request","config","ConfigError","getStaticConfig","JsonFile","read","json5"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAEA;AACA;AACA,SAASA,cAAT,CAAwBC,UAAxB,EAA4CC,OAA5C,EAAiG;AAC/F;AACA,MAAI,CAAC,sBAAWD,UAAX,CAAL,EAA6B;AAC3B,WAAO,IAAP;AACD;;AACD,MAAI;AACF,WAAO,8BAAWA,UAAX,EAAuBC,OAAvB,CAAP;AACD,GAFD,CAEE,OAAOC,KAAP,EAAc;AACd;AACAA,IAAAA,KAAK,CAACC,aAAN,GAAsB,IAAtB;AACAD,IAAAA,KAAK,CAACE,OAAN,GAAiB,gCAA+BJ,UAAW,QAAOE,KAAK,CAACE,OAAQ,EAAhF;AACA,UAAMF,KAAN;AACD;AACF;;AAEM,SAASG,gBAAT,CAA0BC,UAA1B,EAA8CC,OAA9C,EAA4F;AACjG,QAAMC,MAAM,GAAGT,cAAc,CAACO,UAAD,EAAaC,OAAb,CAA7B;;AACA,MAAIC,MAAJ,EAAY;AACV;AACA,WAAOA,MAAP;AACD,GALgG,CAMjG;AACA;;;AACA,QAAM,KAAIC,qBAAJ,EAAiB,6BAA4BH,UAAW,EAAxD,EAA2D,gBAA3D,CAAN;AACD;;AAEM,SAASI,eAAT,CAAyBJ,UAAzB,EAAyE;AAC9E,QAAME,MAAM,GAAGG,oBAASC,IAAT,CAAcN,UAAd,EAA0B;AAAEO,IAAAA,KAAK,EAAE;AAAT,GAA1B,CAAf;;AACA,MAAIL,MAAJ,EAAY;AACV,WAAOA,MAAP;AACD;;AACD,QAAM,KAAIC,qBAAJ,EAAiB,6BAA4BH,UAAW,EAAxD,EAA2D,gBAA3D,CAAN;AACD","sourcesContent":["import JsonFile from '@expo/json-file';\nimport { existsSync } from 'fs';\n\nimport { AppJSONConfig, ConfigContext, ExpoConfig } from './Config.types';\nimport { ConfigError } from './Errors';\nimport { DynamicConfigResults, evalConfig } from './evalConfig';\n\n// We cannot use async config resolution right now because Next.js doesn't support async configs.\n// If they don't add support for async Webpack configs then we may need to pull support for Next.js.\nfunction readConfigFile(configFile: string, context: ConfigContext): null | DynamicConfigResults {\n // If the file doesn't exist then we should skip it and continue searching.\n if (!existsSync(configFile)) {\n return null;\n }\n try {\n return evalConfig(configFile, context);\n } catch (error) {\n // @ts-ignore\n error.isConfigError = true;\n error.message = `Error reading Expo config at ${configFile}:\\n\\n${error.message}`;\n throw error;\n }\n}\n\nexport function getDynamicConfig(configPath: string, request: ConfigContext): DynamicConfigResults {\n const config = readConfigFile(configPath, request);\n if (config) {\n // The config must be serialized and evaluated ahead of time so the spawned process can send it over.\n return config;\n }\n // TODO: It seems this is only thrown if the file cannot be found (which may never happen).\n // If so we should throw a more helpful error.\n throw new ConfigError(`Failed to read config at: ${configPath}`, 'INVALID_CONFIG');\n}\n\nexport function getStaticConfig(configPath: string): AppJSONConfig | ExpoConfig {\n const config = JsonFile.read(configPath, { json5: true });\n if (config) {\n return config as any;\n }\n throw new ConfigError(`Failed to read config at: ${configPath}`, 'INVALID_CONFIG');\n}\n"],"file":"getConfig.js"}
|