1"use strict"; 2Object.defineProperty(exports, "__esModule", { value: true }); 3exports.requireAndResolveExpoModuleConfig = exports.ExpoModuleConfig = void 0; 4/** 5 * A class that wraps the raw config (`expo-module.json` or `unimodule.json`). 6 */ 7class ExpoModuleConfig { 8 constructor(rawConfig) { 9 this.rawConfig = rawConfig; 10 } 11 /** 12 * Whether the module supports given platform. 13 */ 14 supportsPlatform(platform) { 15 var _a, _b; 16 return (_b = (_a = this.rawConfig.platforms) === null || _a === void 0 ? void 0 : _a.includes(platform)) !== null && _b !== void 0 ? _b : false; 17 } 18 /** 19 * Returns a list of names of Swift native modules classes to put to the generated modules provider file. 20 */ 21 iosModulesClassNames() { 22 var _a, _b; 23 return (_b = (_a = this.rawConfig.ios) === null || _a === void 0 ? void 0 : _a.modulesClassNames) !== null && _b !== void 0 ? _b : []; 24 } 25 /** 26 * Returns a list of names of Swift classes that receives AppDelegate life-cycle events. 27 */ 28 iosAppDelegateSubscribers() { 29 var _a, _b; 30 return (_b = (_a = this.rawConfig.ios) === null || _a === void 0 ? void 0 : _a.appDelegateSubscribers) !== null && _b !== void 0 ? _b : []; 31 } 32 /** 33 * Returns a list of names of Swift classes that implement `ExpoReactDelegateHandler`. 34 */ 35 iosReactDelegateHandlers() { 36 var _a, _b; 37 return (_b = (_a = this.rawConfig.ios) === null || _a === void 0 ? void 0 : _a.reactDelegateHandlers) !== null && _b !== void 0 ? _b : []; 38 } 39 /** 40 * Returns a podspec path defined by the module author. 41 */ 42 iosPodspecPath() { 43 var _a; 44 return (_a = this.rawConfig.ios) === null || _a === void 0 ? void 0 : _a.podspecPath; 45 } 46 /** 47 * Returns a list of names of Kotlin native modules classes to put to the generated package provider file. 48 */ 49 androidModulesClassNames() { 50 var _a, _b; 51 return (_b = (_a = this.rawConfig.android) === null || _a === void 0 ? void 0 : _a.modulesClassNames) !== null && _b !== void 0 ? _b : []; 52 } 53 /** 54 * Returns serializable raw config. 55 */ 56 toJSON() { 57 return this.rawConfig; 58 } 59} 60exports.ExpoModuleConfig = ExpoModuleConfig; 61/** 62 * Reads the config at given path and returns the config wrapped by `ExpoModuleConfig` class. 63 */ 64function requireAndResolveExpoModuleConfig(path) { 65 // TODO: Validate the raw config against a schema. 66 // TODO: Support for `*.js` files, not only static `*.json`. 67 return new ExpoModuleConfig(require(path)); 68} 69exports.requireAndResolveExpoModuleConfig = requireAndResolveExpoModuleConfig; 70//# sourceMappingURL=ExpoModuleConfig.js.map