expo-manifests 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,18 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.7.2 — 2023-08-22
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - [iOS] Fix error in handling nested array. ([#23562](https://github.com/expo/expo/pull/23562) by [@douglowder](https://github.com/douglowder))
18
+
19
+ ## 0.7.1 — 2023-06-30
20
+
21
+ ### 🐛 Bug fixes
22
+
23
+ - Fixed iOS build errors in `use_frameworks!` mode. ([#23218](https://github.com/expo/expo/pull/23218) by [@kudo](https://github.com/kudo))
24
+
13
25
  ## 0.7.0 — 2023-06-21
14
26
 
15
27
  ### 📚 3rd party library updates
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '0.7.0'
6
+ version = '0.7.2'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -67,7 +67,7 @@ android {
67
67
  minSdkVersion safeExtGet("minSdkVersion", 21)
68
68
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
69
69
  versionCode 31
70
- versionName '0.7.0'
70
+ versionName '0.7.2'
71
71
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
72
72
  }
73
73
  lintOptions {
@@ -270,12 +270,19 @@ internal sealed class PluginType {
270
270
  private fun fromRawValue(value: Any): PluginType? {
271
271
  return when (value) {
272
272
  is JSONArray -> {
273
- if (value.length() != 2) {
273
+ if (value.length() == 0) {
274
274
  throw IllegalArgumentException("Value for (key = plugins) has incorrect type")
275
275
  }
276
276
  val name = value.get(0) as? String ?: return null
277
- val props = value.get(1) as? JSONObject ?: return null
278
- WithProps(name to props.toMap())
277
+ when (value.length()) {
278
+ 2 -> {
279
+ val props = value.get(1) as? JSONObject ?: return null
280
+ WithProps(name to props.toMap())
281
+ }
282
+ else -> {
283
+ WithoutProps(name)
284
+ }
285
+ }
279
286
  }
280
287
  is String -> {
281
288
  WithoutProps(value)
@@ -9,28 +9,35 @@ import org.junit.Test
9
9
  class ManifestTest {
10
10
  @Test
11
11
  fun getPluginProperties_emptyManifest_returnsNull() {
12
- val manifestJson = JSONObject(emptyMap<String, Any>())
12
+ val manifestJson = JSONObject("{}")
13
13
  val manifest = Manifest.fromManifestJson(manifestJson)
14
14
  Truth.assertThat(manifest.getPluginProperties("test")).isNull()
15
15
  }
16
16
 
17
17
  @Test
18
18
  fun getPluginProperties_emptyPlugins_returnsNull() {
19
- val manifestJson = JSONObject(mapOf<String, Any>("plugins" to emptyArray<Any>()))
19
+ val manifestJson = JSONObject("{\"plugins\": []}")
20
20
  val manifest = Manifest.fromManifestJson(manifestJson)
21
21
  Truth.assertThat(manifest.getPluginProperties("test")).isNull()
22
22
  }
23
23
 
24
24
  @Test
25
25
  fun getPluginProperties_nonMatchedPlugins_returnsNull() {
26
- val manifestJson = JSONObject(mapOf<String, Any>("plugins" to arrayOf("hello")))
26
+ val manifestJson = JSONObject("{\"plugins\": [\"hello\"]}")
27
27
  val manifest = Manifest.fromManifestJson(manifestJson)
28
28
  Truth.assertThat(manifest.getPluginProperties("test")).isNull()
29
29
  }
30
30
 
31
31
  @Test
32
32
  fun getPluginProperties_matchedPluginWithoutProps_returnsNull() {
33
- val manifestJson = JSONObject(mapOf<String, Any>("plugins" to arrayOf("test")))
33
+ val manifestJson = JSONObject("{\"plugins\": [\"test\"]}")
34
+ val manifest = Manifest.fromManifestJson(manifestJson)
35
+ Truth.assertThat(manifest.getPluginProperties("test")).isNull()
36
+ }
37
+
38
+ @Test
39
+ fun getPluginProperties_matchedPluginWithoutPropsAsNestedArray_returnsNull() {
40
+ val manifestJson = JSONObject("{\"plugins\": [[\"test\"]]}")
34
41
  val manifest = Manifest.fromManifestJson(manifestJson)
35
42
  Truth.assertThat(manifest.getPluginProperties("test")).isNull()
36
43
  }
@@ -38,8 +45,7 @@ class ManifestTest {
38
45
  @Test
39
46
  fun getPluginProperties_matchedPluginWithProps_returnsProps() {
40
47
  val props = mapOf<String, Any>("foo" to "bar")
41
- val pluginWithProp = arrayOf("test", props)
42
- val manifestJson = JSONObject(mapOf<String, Any>("plugins" to arrayOf(pluginWithProp)))
48
+ val manifestJson = JSONObject("{\"plugins\": [ [\"test\", {\"foo\":\"bar\"}] ]}")
43
49
  val manifest = Manifest.fromManifestJson(manifestJson)
44
50
  val result = manifest.getPluginProperties("test")
45
51
  Truth.assertThat(result).isNotNull()
@@ -49,8 +55,7 @@ class ManifestTest {
49
55
  @Test
50
56
  fun getPluginProperties_matchedPluginWithNestedProps_returnsNestedProps() {
51
57
  val props = mapOf<String, Any>("nested" to mapOf<String, Any>("insideNested" to true))
52
- val pluginWithProp = arrayOf("test", props)
53
- val manifestJson = JSONObject(mapOf<String, Any>("plugins" to arrayOf(pluginWithProp)))
58
+ val manifestJson = JSONObject("{\"plugins\":[[\"test\",{\"nested\":{\"insideNested\":true}}]]}")
54
59
  val manifest = Manifest.fromManifestJson(manifestJson)
55
60
  val result = manifest.getPluginProperties("test")
56
61
  Truth.assertThat(result).isNotNull()
@@ -3,8 +3,6 @@
3
3
  // this uses abstract class patterns
4
4
  // swiftlint:disable unavailable_function
5
5
 
6
- // swiftlint:disable type_body_length file_length
7
-
8
6
  import Foundation
9
7
  import UIKit
10
8
 
@@ -315,9 +313,8 @@ public class Manifest: NSObject {
315
313
  let sdkMajorVersion = expoGoSDKMajorVersion()
316
314
  if sdkMajorVersion > 0 && sdkMajorVersion < 48 {
317
315
  return "jsc"
318
- } else {
319
- return "hermes"
320
316
  }
317
+ return "hermes"
321
318
  }
322
319
  return jsEngine
323
320
  }
@@ -337,8 +334,14 @@ public class Manifest: NSObject {
337
334
  return nil
338
335
  }
339
336
  if let valueArray = value as? [Any],
340
- let name = valueArray[0] as? String, let props = valueArray[1] as? [String: Any] {
341
- return .withProps((name, props))
337
+ let name = valueArray[0] as? String {
338
+ if valueArray.count > 1 {
339
+ guard let props = valueArray[1] as? [String: Any] else {
340
+ return .withoutProps((name))
341
+ }
342
+ return .withProps((name, props))
343
+ }
344
+ return .withoutProps((name))
342
345
  }
343
346
  if let value = value as? String {
344
347
  return .withoutProps(value)
@@ -411,3 +414,5 @@ public class Manifest: NSObject {
411
414
  return nil
412
415
  }
413
416
  }
417
+
418
+ // swiftlint:enable unavailable_function
@@ -24,11 +24,8 @@ Pod::Spec.new do |s|
24
24
  'DEFINES_MODULE' => 'YES',
25
25
  'SWIFT_COMPILATION_MODE' => 'wholemodule'
26
26
  }
27
-
28
- s.script_phase = {
29
- :name => 'Copy Swift Header',
30
- :script => 'COMPATIBILITY_HEADER_PATH="${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h"; ditto "${COMPATIBILITY_HEADER_PATH}" "${PODS_ROOT}/Headers/Public/${PRODUCT_MODULE_NAME}/${PRODUCT_MODULE_NAME}-Swift.h"',
31
- :execution_position => :after_compile
27
+ s.user_target_xcconfig = {
28
+ 'HEADER_SEARCH_PATHS' => '"${PODS_CONFIGURATION_BUILD_DIR}/EXManifests/Swift Compatibility Header"',
32
29
  }
33
30
 
34
31
  if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
@@ -12,7 +12,7 @@ final class ManifestSpec: ExpoSpec {
12
12
  var manifest = ManifestFactory.manifest(forManifestJSON: manifestJson)
13
13
  expect(manifest.getPluginProperties(packageName: "test")).to(beNil())
14
14
 
15
- manifestJson = ["plugins": []]
15
+ manifestJson = ["plugins": [] as [Any]]
16
16
  manifest = ManifestFactory.manifest(forManifestJSON: manifestJson)
17
17
  expect(manifest.getPluginProperties(packageName: "test")).to(beNil())
18
18
 
@@ -28,11 +28,17 @@ final class ManifestSpec: ExpoSpec {
28
28
  }
29
29
 
30
30
  it("should return matched plugin properties") {
31
- let manifestJson = ["plugins": [["test", ["foo": "bar"]]]]
31
+ let manifestJson = ["plugins": [["test", ["foo": "bar"]] as [Any]]]
32
32
  let manifest = ManifestFactory.manifest(forManifestJSON: manifestJson)
33
33
  let props = manifest.getPluginProperties(packageName: "test")
34
34
  expect(props as? [String: String]) == ["foo": "bar"]
35
35
  }
36
+
37
+ it("should not crash with array with name and no props") {
38
+ let manifestJson = ["plugins": [["test"]]]
39
+ let manifest = ManifestFactory.manifest(forManifestJSON: manifestJson)
40
+ expect(manifest.getPluginProperties(packageName: "test")).to(beNil())
41
+ }
36
42
  }
37
43
  }
38
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-manifests",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "Code to parse and use Expo and Expo Updates manifests.",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -22,5 +22,5 @@
22
22
  "dependencies": {
23
23
  "expo-json-utils": "~0.7.0"
24
24
  },
25
- "gitHead": "fa5ecca8251986b9f197cc14074eec0ab6dfb6db"
25
+ "gitHead": "ca6e2711477ff273a7a91a81947f933dba2935b0"
26
26
  }