Files
Kudo Chien 5ad98fb352 [dev-server] support building hermes bytecode bundle for ios (#3814)
# Why

support building hermes bytecode bundle for ios

# How

- add ios and shared `jsEngine` support to `isEnableHermesManaged` 
- some refactoring to make `maybeAddHermesBundleAsync` clear
  = move sdk check into HermesBundler.ts
  = move throwing error of `maybeInconsistentEngine*` into HermesBundler.ts
- add `maybeInconsistentEngineIosAsync` to support Podfile.properties.json

# Test Plan

### new unit tests

```
 PASS   @expo/dev-server  src/__tests__/HermesBundler-test.ts
  isEnableHermesManaged
    ✓ should support shared jsEngine key
    ✓ platform jsEngine should override shared jsEngine
    ✓ should exclude old SDK (18 ms)
  maybeThrowFromInconsistentEngineAsync - ios
    ✓ should resolve if ":hermes_enabled => true" in Podfile and "jsEngine: 'hermes'" in app.json (1 ms)
    ✓ should throw if ":hermes_enabled => true" in Podfile but no "jsEngine: 'hermes'" in app.json
    ✓ should throw if (":hermes_enabled => false" or not existed in Podfile) and "jsEngine: 'hermes'" in app.json (1 ms)
    ✓ should resolve if "expo.jsEngine": 'hermes' in Podfile.properties.json and "jsEngine: 'hermes'" in app.json
    ✓ should handle the inconsistency between Podfile and Podfile.properties.json
```

### updated unit tests (mostly for `maybeThrowFromInconsistentEngineAsync` interface change)

```
  maybeThrowFromInconsistentEngineAsync - common
    ✓ should resolve for managed project
  maybeThrowFromInconsistentEngineAsync - android
    ✓ should resolve if "enableHermes: true" in app/build.gradle and "jsEngine: 'hermes'" in app.json (3 ms)
    ✓ should throw if "enableHermes: false" in app/build.gradle and "jsEngine: 'hermes'" in app.json (1 ms)
    ✓ should resolve if "expo.jsEngine=hermes" in gradle.properties and "jsEngine: 'hermes'" in app.json (1 ms)
    ✓ should resolve if "expo.jsEngine=hermes" in gradle.properties but no "jsEngine: 'hermes'" in app.json
    ✓ should resolve for old sdk bare project
    ✓ should handle the inconsistency between app/build.gradle and gradle.properties
```

### manually test

```sh
$ expo init extest # select managed
# add `jsEngine: "hermes"` and `sdkVersion: "UNVERSIONED"` to app.json
$ EXPO_SKIP_MANIFEST_VALIDATION_TOKEN=1 /path/to/expo-cli/packages/expo-cli/bin/expo.js export -p https://example.com/
```
2021-09-09 14:30:46 +08:00
..
2021-09-02 17:16:26 -06:00