@expo/dev-server
Advanced tools
Comparing version
@@ -50,9 +50,2 @@ "use strict"; | ||
} | ||
function _semver() { | ||
const data = _interopRequireDefault(require("semver")); | ||
_semver = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _importMetroFromProject() { | ||
@@ -70,27 +63,9 @@ const data = require("./metro/importMetroFromProject"); | ||
{ | ||
var _expoConfig$android$j2, _expoConfig$android2; | ||
if (!gteSdkVersion(expoConfig, '42.0.0')) { | ||
// Hermes on Android is supported after SDK 42. | ||
return false; | ||
} | ||
if (gteSdkVersion(expoConfig, '48.0.0')) { | ||
var _expoConfig$android$j, _expoConfig$android; | ||
// Hermes on Android is enabled by default after SDK 48. | ||
return ((_expoConfig$android$j = (_expoConfig$android = expoConfig.android) === null || _expoConfig$android === void 0 ? void 0 : _expoConfig$android.jsEngine) !== null && _expoConfig$android$j !== void 0 ? _expoConfig$android$j : expoConfig.jsEngine) !== 'jsc'; | ||
} | ||
return ((_expoConfig$android$j2 = (_expoConfig$android2 = expoConfig.android) === null || _expoConfig$android2 === void 0 ? void 0 : _expoConfig$android2.jsEngine) !== null && _expoConfig$android$j2 !== void 0 ? _expoConfig$android$j2 : expoConfig.jsEngine) === 'hermes'; | ||
var _expoConfig$android$j, _expoConfig$android; | ||
return ((_expoConfig$android$j = (_expoConfig$android = expoConfig.android) === null || _expoConfig$android === void 0 ? void 0 : _expoConfig$android.jsEngine) !== null && _expoConfig$android$j !== void 0 ? _expoConfig$android$j : expoConfig.jsEngine) !== 'jsc'; | ||
} | ||
case 'ios': | ||
{ | ||
var _expoConfig$ios$jsEng2, _expoConfig$ios2; | ||
if (!gteSdkVersion(expoConfig, '43.0.0')) { | ||
// Hermes on iOS is supported after SDK 43. | ||
return false; | ||
} | ||
if (gteSdkVersion(expoConfig, '48.0.0')) { | ||
var _expoConfig$ios$jsEng, _expoConfig$ios; | ||
// Hermes on iOS is enabled by default after SDK 48. | ||
return ((_expoConfig$ios$jsEng = (_expoConfig$ios = expoConfig.ios) === null || _expoConfig$ios === void 0 ? void 0 : _expoConfig$ios.jsEngine) !== null && _expoConfig$ios$jsEng !== void 0 ? _expoConfig$ios$jsEng : expoConfig.jsEngine) !== 'jsc'; | ||
} | ||
return ((_expoConfig$ios$jsEng2 = (_expoConfig$ios2 = expoConfig.ios) === null || _expoConfig$ios2 === void 0 ? void 0 : _expoConfig$ios2.jsEngine) !== null && _expoConfig$ios$jsEng2 !== void 0 ? _expoConfig$ios$jsEng2 : expoConfig.jsEngine) === 'hermes'; | ||
var _expoConfig$ios$jsEng, _expoConfig$ios; | ||
return ((_expoConfig$ios$jsEng = (_expoConfig$ios = expoConfig.ios) === null || _expoConfig$ios === void 0 ? void 0 : _expoConfig$ios.jsEngine) !== null && _expoConfig$ios$jsEng !== void 0 ? _expoConfig$ios$jsEng : expoConfig.jsEngine) !== 'jsc'; | ||
} | ||
@@ -157,13 +132,2 @@ default: | ||
// Check android/app/build.gradle for "enableHermes: true", for SDK < 48 | ||
const appBuildGradlePath = _path().default.join(projectRoot, 'android', 'app', 'build.gradle'); | ||
if (_fsExtra().default.existsSync(appBuildGradlePath)) { | ||
const content = await _fsExtra().default.readFile(appBuildGradlePath, 'utf8'); | ||
const isPropsReference = content.search(/^\s*enableHermes:\s*\(findProperty\('expo.jsEngine'\) \?: "jsc"\) == "hermes",?\s+/m) >= 0; | ||
const isHermesBare = content.search(/^\s*enableHermes:\s*true,?\s+/m) >= 0; | ||
if (!isPropsReference && isHermesManaged !== isHermesBare) { | ||
return true; | ||
} | ||
} | ||
// Check gradle.properties from prebuild template | ||
@@ -173,3 +137,3 @@ const gradlePropertiesPath = _path().default.join(projectRoot, 'android', 'gradle.properties'); | ||
const props = parseGradleProperties(await _fsExtra().default.readFile(gradlePropertiesPath, 'utf8')); | ||
const isHermesBare = props['expo.jsEngine'] === 'hermes' || props['hermesEnabled'] === 'true'; | ||
const isHermesBare = props['hermesEnabled'] === 'true'; | ||
if (isHermesManaged !== isHermesBare) { | ||
@@ -188,10 +152,3 @@ return true; | ||
const content = await _fsExtra().default.readFile(podfilePath, 'utf8'); | ||
const hermesPropReferences = [ | ||
// sdk 45 | ||
/^\s*:hermes_enabled\s*=>\s*flags\[:hermes_enabled\]\s*\|\|\s*podfile_properties\['expo.jsEngine'\]\s*==\s*'hermes',?/m, | ||
// <= sdk 44 | ||
/^\s*:hermes_enabled\s*=>\s*podfile_properties\['expo.jsEngine'\] == 'hermes',?\s+/m, | ||
// sdk 48 | ||
/^\s*:hermes_enabled\s*=>\s*podfile_properties\['expo.jsEngine'\]\s*==\s*nil\s*\|\|\s*podfile_properties\['expo.jsEngine'\]\s*==\s*'hermes',?/m]; | ||
const isPropsReference = hermesPropReferences.reduce((prev, curr) => prev || content.search(curr) >= 0, false); | ||
const isPropsReference = content.search(/^\s*:hermes_enabled\s*=>\s*podfile_properties\['expo.jsEngine'\]\s*==\s*nil\s*\|\|\s*podfile_properties\['expo.jsEngine'\]\s*==\s*'hermes',?/m) >= 0; | ||
const isHermesBare = content.search(/^\s*:hermes_enabled\s*=>\s*true,?\s+/m) >= 0; | ||
@@ -235,17 +192,2 @@ if (!isPropsReference && isHermesManaged !== isHermesBare) { | ||
} | ||
// Cloned from xdl/src/Versions.ts, we cannot use that because of circular dependency | ||
function gteSdkVersion(expJson, sdkVersion) { | ||
if (!expJson.sdkVersion) { | ||
return false; | ||
} | ||
if (expJson.sdkVersion === 'UNVERSIONED') { | ||
return true; | ||
} | ||
try { | ||
return _semver().default.gte(expJson.sdkVersion, sdkVersion); | ||
} catch { | ||
throw new Error(`${expJson.sdkVersion} is not a valid version. Must be in the form of x.y.z`); | ||
} | ||
} | ||
async function parsePodfilePropertiesAsync(podfilePropertiesPath) { | ||
@@ -252,0 +194,0 @@ try { |
{ | ||
"name": "@expo/dev-server", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "Development servers for starting React Native projects", | ||
@@ -46,3 +46,2 @@ "main": "build/MetroDevServer.js", | ||
"resolve-from": "^5.0.0", | ||
"semver": "7.5.3", | ||
"serialize-error": "6.0.0", | ||
@@ -57,3 +56,3 @@ "temp-dir": "^2.0.0" | ||
}, | ||
"gitHead": "dce1880a2dc156f551847c78ac8bb4d2420e7ff3" | ||
"gitHead": "554e8b88a1a5d7f54c67cdb66e928a0adfb8731d" | ||
} |
Sorry, the diff of this file is not supported yet
15
-6.25%177172
-3.85%1840
-2.95%- Removed