expo-manifests 0.13.2 → 0.14.1

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,11 +10,28 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 0.13.2 — 2024-01-18
13
+ ## 0.14.1 — 2024-04-29
14
14
 
15
15
  _This version does not introduce any user-facing changes._
16
16
 
17
- ## 0.13.1 — 2024-01-10
17
+ ## 0.14.0 — 2024-04-18
18
+
19
+ ### 🛠 Breaking changes
20
+
21
+ - Remove classic updates. ([#26036](https://github.com/expo/expo/pull/26036), [#26048](https://github.com/expo/expo/pull/26048) by [@wschurman](https://github.com/wschurman))
22
+
23
+ ### 💡 Others
24
+
25
+ - [Android] Remove unsafe internal mutation capability. ([#26229](https://github.com/expo/expo/pull/26229) by [@wschurman](https://github.com/wschurman))
26
+ - Rename manifest classes. ([#26234](https://github.com/expo/expo/pull/26234), [#26235](https://github.com/expo/expo/pull/26235), [#26257](https://github.com/expo/expo/pull/26257) by [@wschurman](https://github.com/wschurman))
27
+ - Remove use of legacy sdkVersion runtimeVersion policy. ([#26957](https://github.com/expo/expo/pull/26957) by [@wschurman](https://github.com/wschurman))
28
+ - Removed deprecated backward compatible Gradle settings. ([#28083](https://github.com/expo/expo/pull/28083) by [@kudo](https://github.com/kudo))
29
+
30
+ ## 0.13.2 - 2024-01-18
31
+
32
+ _This version does not introduce any user-facing changes._
33
+
34
+ ## 0.13.1 - 2024-01-10
18
35
 
19
36
  _This version does not introduce any user-facing changes._
20
37
 
@@ -1,99 +1,20 @@
1
1
  apply plugin: 'com.android.library'
2
- apply plugin: 'kotlin-android'
3
- apply plugin: 'maven-publish'
4
2
 
5
3
  group = 'host.exp.exponent'
6
- version = '0.13.2'
4
+ version = '0.14.1'
7
5
 
8
6
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
- if (expoModulesCorePlugin.exists()) {
10
- apply from: expoModulesCorePlugin
11
- applyKotlinExpoModulesCorePlugin()
12
- // Remove this check, but keep the contents after SDK49 support is dropped
13
- if (safeExtGet("expoProvidesDefaultConfig", false)) {
14
- useExpoPublishing()
15
- }
16
- }
17
-
18
- buildscript {
19
- // Simple helper that allows the root project to override versions declared by this library.
20
- ext.safeExtGet = { prop, fallback ->
21
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
22
- }
23
-
24
- // Ensures backward compatibility
25
- ext.getKotlinVersion = {
26
- if (ext.has("kotlinVersion")) {
27
- ext.kotlinVersion()
28
- } else {
29
- ext.safeExtGet("kotlinVersion", "1.8.10")
30
- }
31
- }
32
-
33
- repositories {
34
- mavenCentral()
35
- }
36
-
37
- dependencies {
38
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
39
- }
40
- }
41
-
42
- // Remove this if and it's contents, when support for SDK49 is dropped
43
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
44
- afterEvaluate {
45
- publishing {
46
- publications {
47
- release(MavenPublication) {
48
- from components.release
49
- }
50
- }
51
- repositories {
52
- maven {
53
- url = mavenLocal().url
54
- }
55
- }
56
- }
57
- }
58
- }
7
+ apply from: expoModulesCorePlugin
8
+ applyKotlinExpoModulesCorePlugin()
9
+ useCoreDependencies()
10
+ useDefaultAndroidSdkVersions()
11
+ useExpoPublishing()
59
12
 
60
13
  android {
61
- // Remove this if and it's contents, when support for SDK49 is dropped
62
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
63
- compileSdkVersion safeExtGet("compileSdkVersion", 34)
64
-
65
- defaultConfig {
66
- minSdkVersion safeExtGet("minSdkVersion", 23)
67
- targetSdkVersion safeExtGet("targetSdkVersion", 34)
68
- }
69
-
70
- publishing {
71
- singleVariant("release") {
72
- withSourcesJar()
73
- }
74
- }
75
-
76
- lintOptions {
77
- abortOnError false
78
- }
79
- }
80
-
81
- def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
82
- if (agpVersion.tokenize('.')[0].toInteger() < 8) {
83
- compileOptions {
84
- sourceCompatibility JavaVersion.VERSION_11
85
- targetCompatibility JavaVersion.VERSION_11
86
- }
87
-
88
- kotlinOptions {
89
- jvmTarget = JavaVersion.VERSION_11.majorVersion
90
- }
91
- }
92
-
93
14
  namespace "expo.modules.manifests"
94
15
  defaultConfig {
95
16
  versionCode 31
96
- versionName '0.13.2'
17
+ versionName '0.14.1'
97
18
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
98
19
  }
99
20
  testOptions {
@@ -113,9 +34,4 @@ dependencies {
113
34
  testImplementation 'io.mockk:mockk:1.13.5'
114
35
  testImplementation 'org.json:json:20230227'
115
36
  testImplementation "com.google.truth:truth:1.1.2"
116
-
117
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
118
- }
119
- repositories {
120
- mavenCentral()
121
37
  }
@@ -6,7 +6,16 @@ import org.json.JSONArray
6
6
  import org.json.JSONException
7
7
  import org.json.JSONObject
8
8
 
9
- abstract class BaseLegacyManifest(json: JSONObject) : Manifest(json) {
9
+ class EmbeddedManifest(json: JSONObject) : Manifest(json) {
10
+ /**
11
+ * A UUID for this manifest.
12
+ */
13
+ @Throws(JSONException::class)
14
+ fun getID(): String = json.require("id")
15
+
16
+ @Throws(JSONException::class)
17
+ fun getCommitTimeLong(): Long = json.require("commitTime")
18
+
10
19
  override fun getStableLegacyID(): String = json.getNullable("originalFullName") ?: getLegacyID()
11
20
 
12
21
  override fun getScopeKey(): String = json.getNullable("scopeKey") ?: getStableLegacyID()
@@ -20,17 +29,15 @@ abstract class BaseLegacyManifest(json: JSONObject) : Manifest(json) {
20
29
 
21
30
  override fun getExpoGoSDKVersion(): String? = json.getNullable("sdkVersion")
22
31
 
23
- override fun getExpoGoConfigRootObject(): JSONObject? {
32
+ override fun getExpoGoConfigRootObject(): JSONObject {
24
33
  return json
25
34
  }
26
35
 
27
- override fun getExpoClientConfigRootObject(): JSONObject? {
36
+ override fun getExpoClientConfigRootObject(): JSONObject {
28
37
  return json
29
38
  }
30
39
 
31
40
  override fun getSlug(): String? = json.getNullable("slug")
32
41
 
33
42
  override fun getAppKey(): String? = json.getNullable("appKey")
34
-
35
- fun getCommitTime(): String? = json.getNullable("commitTime")
36
43
  }
@@ -5,10 +5,8 @@ import expo.modules.jsonutils.require
5
5
  import org.json.JSONArray
6
6
  import org.json.JSONException
7
7
  import org.json.JSONObject
8
- import java.util.regex.Matcher
9
- import java.util.regex.Pattern
10
8
 
11
- class NewManifest(json: JSONObject) : Manifest(json) {
9
+ class ExpoUpdatesManifest(json: JSONObject) : Manifest(json) {
12
10
  /**
13
11
  * An ID representing this manifest, not the ID for the experience.
14
12
  */
@@ -33,23 +31,8 @@ class NewManifest(json: JSONObject) : Manifest(json) {
33
31
  @Throws(JSONException::class)
34
32
  override fun getBundleURL(): String = getLaunchAsset().require("url")
35
33
 
36
- @Deprecated(message = "exposdk:... runtime version is deprecated")
37
- private fun getSDKVersionFromRuntimeVersion(): String? {
38
- val runtimeVersion = getRuntimeVersion()
39
- if (runtimeVersion == "exposdk:UNVERSIONED") {
40
- return "UNVERSIONED"
41
- }
42
-
43
- val expoSDKRuntimeVersionRegex: Pattern = Pattern.compile("^exposdk:(\\d+\\.\\d+\\.\\d+)$")
44
- val expoSDKRuntimeVersionMatch: Matcher = expoSDKRuntimeVersionRegex.matcher(runtimeVersion)
45
- if (expoSDKRuntimeVersionMatch.find()) {
46
- return expoSDKRuntimeVersionMatch.group(1)!!
47
- }
48
- return null
49
- }
50
-
51
34
  override fun getExpoGoSDKVersion(): String? {
52
- return getExpoClientConfigRootObject()?.getString("sdkVersion") ?: getSDKVersionFromRuntimeVersion()
35
+ return getExpoClientConfigRootObject()?.getString("sdkVersion")
53
36
  }
54
37
 
55
38
  @Throws(JSONException::class)
@@ -6,20 +6,7 @@ import org.json.JSONArray
6
6
  import org.json.JSONException
7
7
  import org.json.JSONObject
8
8
 
9
- interface InternalJSONMutator {
10
- @Throws(JSONException::class)
11
- fun updateJSON(json: JSONObject)
12
- }
13
-
14
9
  abstract class Manifest(protected val json: JSONObject) {
15
- @Deprecated(message = "Strive for manifests to be immutable")
16
- @Throws(JSONException::class)
17
- fun mutateInternalJSONInPlace(internalJSONMutator: InternalJSONMutator) {
18
- json.apply {
19
- internalJSONMutator.updateJSON(this)
20
- }
21
- }
22
-
23
10
  @Deprecated(message = "Prefer to use specific field getters")
24
11
  fun getRawJson(): JSONObject = json
25
12
 
@@ -244,14 +231,16 @@ abstract class Manifest(protected val json: JSONObject) {
244
231
  companion object {
245
232
  @JvmStatic fun fromManifestJson(manifestJson: JSONObject): Manifest {
246
233
  return when {
234
+ // TODO(wschurman): remove error in a few major releases after SDK 51 when it's unlikely classic updates
235
+ // may erroneously be served
247
236
  manifestJson.has("releaseId") -> {
248
- LegacyManifest(manifestJson)
237
+ throw Exception("Legacy manifests are no longer supported")
249
238
  }
250
239
  manifestJson.has("metadata") -> {
251
- NewManifest(manifestJson)
240
+ ExpoUpdatesManifest(manifestJson)
252
241
  }
253
242
  else -> {
254
- BareManifest(manifestJson)
243
+ EmbeddedManifest(manifestJson)
255
244
  }
256
245
  }
257
246
  }
@@ -46,9 +46,9 @@ export type ExpoGoPackagerOpts = {
46
46
  [key: string]: any;
47
47
  };
48
48
  /**
49
- * A modern manifest.
49
+ * A expo-updates manifest.
50
50
  */
51
- export type NewManifest = {
51
+ export type ExpoUpdatesManifest = {
52
52
  id: string;
53
53
  createdAt: string;
54
54
  runtimeVersion: string;
@@ -58,13 +58,23 @@ export type NewManifest = {
58
58
  extra?: ManifestExtra;
59
59
  };
60
60
  /**
61
- * An embedded bare manifest.
61
+ * @deprecated renamed to ExpoUpdatesManifest, will be removed in a few versions
62
+ * @see ExpoUpdatesManifest
63
+ */
64
+ export type NewManifest = ExpoUpdatesManifest;
65
+ /**
66
+ * An embedded manifest.
62
67
  *
63
68
  * Generated during build in createManifest.js build step script.
64
69
  */
65
- export type BareManifest = {
70
+ export type EmbeddedManifest = {
66
71
  id: string;
67
72
  commitTime: number;
68
73
  assets: any[];
69
74
  };
75
+ /**
76
+ * @deprecated renamed to EmbeddedManifest, will be removed in a few versions
77
+ * @see EmbeddedManifest
78
+ */
79
+ export type BareManifest = EmbeddedManifest;
70
80
  //# sourceMappingURL=Manifests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Manifests.d.ts","sourceRoot":"","sources":["../src/Manifests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG;IAChD,UAAU,CAAC,EAAE,UAAU,GAAG;QACxB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,CAAC;AAGF,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAGF,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,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ifests.ts"],"names":[],"mappings":"","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\n// @docsMissing\nexport interface ManifestAsset {\n url: string;\n}\n// @docsMissing\nexport type ManifestExtra = ClientScopingConfig & {\n expoClient?: ExpoConfig & {\n /**\n * Only present during development using @expo/cli.\n */\n hostUri?: string;\n };\n expoGo?: ExpoGoConfig;\n eas?: EASConfig;\n};\n\n// @needsAudit\nexport type EASConfig = {\n /**\n * The ID for this project if it's using EAS. UUID. This value will not change when a project is\n * transferred between accounts or renamed.\n */\n projectId?: string;\n};\n\n// @needsAudit\nexport type ClientScopingConfig = {\n /**\n * An opaque unique string for scoping client-side data to this project. This value\n * will not change when a project is transferred between accounts or renamed.\n */\n scopeKey?: string;\n};\n\n// @docsMissing\nexport type ExpoGoConfig = {\n mainModuleName?: string;\n debuggerHost?: string;\n developer?: {\n tool?: string;\n [key: string]: any;\n };\n packagerOpts?: ExpoGoPackagerOpts;\n};\n\n// @docsMissing\nexport type ExpoGoPackagerOpts = {\n hostType?: string;\n dev?: boolean;\n strict?: boolean;\n minify?: boolean;\n urlType?: string;\n urlRandomness?: string;\n lanType?: string;\n [key: string]: any;\n};\n\n/**\n * A modern manifest.\n */\nexport type NewManifest = {\n id: string;\n createdAt: string;\n runtimeVersion: string;\n launchAsset: ManifestAsset;\n assets: ManifestAsset[];\n metadata: object;\n extra?: ManifestExtra;\n};\n\n/**\n * An embedded bare manifest.\n *\n * Generated during build in createManifest.js build step script.\n */\nexport type BareManifest = {\n id: string;\n commitTime: number;\n assets: any[]; // intentionally underspecified for now since there are no uses in JS\n};\n"]}
1
+ {"version":3,"file":"Manifests.js","sourceRoot":"","sources":["../src/Manifests.ts"],"names":[],"mappings":"","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\n// @docsMissing\nexport interface ManifestAsset {\n url: string;\n}\n// @docsMissing\nexport type ManifestExtra = ClientScopingConfig & {\n expoClient?: ExpoConfig & {\n /**\n * Only present during development using @expo/cli.\n */\n hostUri?: string;\n };\n expoGo?: ExpoGoConfig;\n eas?: EASConfig;\n};\n\n// @needsAudit\nexport type EASConfig = {\n /**\n * The ID for this project if it's using EAS. UUID. This value will not change when a project is\n * transferred between accounts or renamed.\n */\n projectId?: string;\n};\n\n// @needsAudit\nexport type ClientScopingConfig = {\n /**\n * An opaque unique string for scoping client-side data to this project. This value\n * will not change when a project is transferred between accounts or renamed.\n */\n scopeKey?: string;\n};\n\n// @docsMissing\nexport type ExpoGoConfig = {\n mainModuleName?: string;\n debuggerHost?: string;\n developer?: {\n tool?: string;\n [key: string]: any;\n };\n packagerOpts?: ExpoGoPackagerOpts;\n};\n\n// @docsMissing\nexport type ExpoGoPackagerOpts = {\n hostType?: string;\n dev?: boolean;\n strict?: boolean;\n minify?: boolean;\n urlType?: string;\n urlRandomness?: string;\n lanType?: string;\n [key: string]: any;\n};\n\n/**\n * A expo-updates manifest.\n */\nexport type ExpoUpdatesManifest = {\n id: string;\n createdAt: string;\n runtimeVersion: string;\n launchAsset: ManifestAsset;\n assets: ManifestAsset[];\n metadata: object;\n extra?: ManifestExtra;\n};\n\n/**\n * @deprecated renamed to ExpoUpdatesManifest, will be removed in a few versions\n * @see ExpoUpdatesManifest\n */\nexport type NewManifest = ExpoUpdatesManifest;\n\n/**\n * An embedded manifest.\n *\n * Generated during build in createManifest.js build step script.\n */\nexport type EmbeddedManifest = {\n id: string;\n commitTime: number;\n assets: any[]; // intentionally underspecified for now since there are no uses in JS\n};\n\n/**\n * @deprecated renamed to EmbeddedManifest, will be removed in a few versions\n * @see EmbeddedManifest\n */\nexport type BareManifest = EmbeddedManifest;\n"]}
@@ -2,9 +2,21 @@
2
2
 
3
3
  import Foundation
4
4
 
5
- @objc(EXManifestBaseLegacyManifest)
5
+ @objc(EXManifestsEmbeddedManifest)
6
6
  @objcMembers
7
- public class BaseLegacyManifest: Manifest {
7
+ public class EmbeddedManifest: Manifest {
8
+ public func rawId() -> String {
9
+ return rawManifestJSON().requiredValue(forKey: "id")
10
+ }
11
+
12
+ public func commitTimeNumber() -> Int {
13
+ return rawManifestJSON().requiredValue(forKey: "commitTime")
14
+ }
15
+
16
+ public func metadata() -> [String: Any]? {
17
+ return rawManifestJSON().optionalValue(forKey: "metadata")
18
+ }
19
+
8
20
  public override func expoClientConfigRootObject() -> [String: Any]? {
9
21
  return rawManifestJSON()
10
22
  }
@@ -2,9 +2,9 @@
2
2
 
3
3
  import Foundation
4
4
 
5
- @objc(EXManifestsNewManifest)
5
+ @objc(EXManifestsExpoUpdatesManifest)
6
6
  @objcMembers
7
- public class NewManifest: Manifest {
7
+ public class ExpoUpdatesManifest: Manifest {
8
8
  public func rawId() -> String {
9
9
  return rawManifestJSON().requiredValue(forKey: "id")
10
10
  }
@@ -37,28 +37,8 @@ public class NewManifest: Manifest {
37
37
  return rawManifestJSON().requiredValue(forKey: "runtimeVersion")
38
38
  }
39
39
 
40
- private func getSDKVersionFromRuntimeVersion() -> String? {
41
- let runtimeVersion = runtimeVersion()
42
- if runtimeVersion == "exposdk:UNVERSIONED" {
43
- return "UNVERSIONED"
44
- }
45
-
46
- // The pattern is valid, so it'll never throw
47
- // swiftlint:disable:next force_try
48
- let regex = try! NSRegularExpression(pattern: "^exposdk:(\\d+\\.\\d+\\.\\d+)$", options: [])
49
- guard let match = regex.firstMatch(
50
- in: runtimeVersion,
51
- options: [],
52
- range: NSRange(runtimeVersion.startIndex..<runtimeVersion.endIndex, in: runtimeVersion)
53
- ),
54
- let range = Range(match.range(at: 1), in: runtimeVersion) else {
55
- return nil
56
- }
57
- return String(runtimeVersion[range])
58
- }
59
-
60
40
  public override func expoGoSDKVersion() -> String? {
61
- return expoClientConfigRootObject()?.optionalValue(forKey: "sdkVersion") ?? getSDKVersionFromRuntimeVersion()
41
+ return expoClientConfigRootObject()?.optionalValue(forKey: "sdkVersion")
62
42
  }
63
43
 
64
44
  public func launchAsset() -> [String: Any] {
@@ -6,12 +6,10 @@ import Foundation
6
6
  @objcMembers
7
7
  public class ManifestFactory: NSObject {
8
8
  public static func manifest(forManifestJSON: [String: Any]) -> Manifest {
9
- if forManifestJSON["releaseId"] != nil {
10
- return LegacyManifest(rawManifestJSON: forManifestJSON)
11
- } else if forManifestJSON["metadata"] != nil {
12
- return NewManifest(rawManifestJSON: forManifestJSON)
13
- } else {
14
- return BareManifest(rawManifestJSON: forManifestJSON)
9
+ if forManifestJSON["metadata"] != nil {
10
+ return ExpoUpdatesManifest(rawManifestJSON: forManifestJSON)
15
11
  }
12
+
13
+ return EmbeddedManifest(rawManifestJSON: forManifestJSON)
16
14
  }
17
15
  }
@@ -8,7 +8,7 @@ enum ManifestTestError: Error {
8
8
  case testError
9
9
  }
10
10
 
11
- class BareManifestSpec : ExpoSpec {
11
+ class EmbeddedManifestSpec : ExpoSpec {
12
12
  override class func spec() {
13
13
  describe("instantiation") {
14
14
  it("instantiates and reads properties") {
@@ -22,7 +22,7 @@ class BareManifestSpec : ExpoSpec {
22
22
  throw ManifestTestError.testError
23
23
  }
24
24
 
25
- let manifest = BareManifest(rawManifestJSON: manifestJsonObject)
25
+ let manifest = EmbeddedManifest(rawManifestJSON: manifestJsonObject)
26
26
 
27
27
  expect(manifest.rawId()) == "0eef8214-4833-4089-9dff-b4138a14f196"
28
28
  expect(manifest.commitTimeNumber()) == 1609975977832
@@ -4,7 +4,7 @@ import ExpoModulesTestCore
4
4
 
5
5
  @testable import EXManifests
6
6
 
7
- class NewManifestSpec : ExpoSpec {
7
+ class ExpoUpdatesManifestSpec : ExpoSpec {
8
8
  override class func spec() {
9
9
  describe("instantiation") {
10
10
  it("instantiates and reads properties") {
@@ -18,7 +18,7 @@ class NewManifestSpec : ExpoSpec {
18
18
  throw ManifestTestError.testError
19
19
  }
20
20
 
21
- let manifest = NewManifest(rawManifestJSON: manifestJsonObject)
21
+ let manifest = ExpoUpdatesManifest(rawManifestJSON: manifestJsonObject)
22
22
 
23
23
  expect(manifest.rawId()) == "0eef8214-4833-4089-9dff-b4138a14f196"
24
24
  expect(manifest.createdAt()) == "2020-11-11T00:17:54.797Z"
@@ -62,34 +62,27 @@ class NewManifestSpec : ExpoSpec {
62
62
 
63
63
  describe("SDK Version") {
64
64
  it("is correct with valid numeric case") {
65
- let runtimeVersion = "exposdk:39.0.0"
66
- let manifestJson = ["runtimeVersion": runtimeVersion]
67
- let manifest = NewManifest(rawManifestJSON: manifestJson)
65
+ let manifestJson = [
66
+ "extra": [
67
+ "expoClient": [
68
+ "sdkVersion": "39.0.0"
69
+ ]
70
+ ]
71
+ ]
72
+ let manifest = ExpoUpdatesManifest(rawManifestJSON: manifestJson)
68
73
  expect(manifest.expoGoSDKVersion()) == "39.0.0"
69
74
  }
70
75
 
71
76
  it("is UNVERSIONED with valid unversioned case") {
72
- let runtimeVersion = "exposdk:UNVERSIONED"
73
- let manifestJson = ["runtimeVersion": runtimeVersion]
74
- let manifest = NewManifest(rawManifestJSON: manifestJson)
75
- expect(manifest.expoGoSDKVersion()) == "UNVERSIONED"
76
- }
77
-
78
- it("is nil with non-sdk runtime version cases") {
79
- let runtimeVersions = [
80
- "exposdk:123",
81
- "exposdkd:39.0.0",
82
- "exposdk:hello",
83
- "bexposdk:39.0.0",
84
- "exposdk:39.0.0-beta.0",
85
- "exposdk:39.0.0-alpha.256"
77
+ let manifestJson = [
78
+ "extra": [
79
+ "expoClient": [
80
+ "sdkVersion": "UNVERSIONED"
81
+ ]
82
+ ]
86
83
  ]
87
-
88
- for runtimeVersion in runtimeVersions {
89
- let manifestJson = ["runtimeVersion": runtimeVersion]
90
- let manifest = NewManifest(rawManifestJSON: manifestJson)
91
- expect(manifest.expoGoSDKVersion()).to(beNil())
92
- }
84
+ let manifest = ExpoUpdatesManifest(rawManifestJSON: manifestJson)
85
+ expect(manifest.expoGoSDKVersion()) == "UNVERSIONED"
93
86
  }
94
87
  }
95
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-manifests",
3
- "version": "0.13.2",
3
+ "version": "0.14.1",
4
4
  "description": "Code to parse and use Expo and Expo Updates manifests.",
5
5
  "main": "build/Manifests.js",
6
6
  "types": "build/Manifests.d.ts",
@@ -29,13 +29,13 @@
29
29
  },
30
30
  "author": "650 Industries, Inc.",
31
31
  "license": "MIT",
32
- "homepage": "https://docs.expo.dev/versions/latest/sdk/module-template",
32
+ "homepage": "https://docs.expo.dev/versions/latest/sdk/manifests/",
33
33
  "jest": {
34
34
  "preset": "expo-module-scripts"
35
35
  },
36
36
  "dependencies": {
37
- "expo-json-utils": "~0.12.0",
38
- "@expo/config": "~8.5.0"
37
+ "@expo/config": "~9.0.0-beta.0",
38
+ "expo-json-utils": "~0.13.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "expo-module-scripts": "^3.0.0"
@@ -43,5 +43,5 @@
43
43
  "peerDependencies": {
44
44
  "expo": "*"
45
45
  },
46
- "gitHead": "102899632731658eecba006c0d1c79b98ba8f5f7"
46
+ "gitHead": "4a7cf0d0baf6dfc595d93f604945d2142e705a36"
47
47
  }
package/src/Manifests.ts CHANGED
@@ -58,9 +58,9 @@ export type ExpoGoPackagerOpts = {
58
58
  };
59
59
 
60
60
  /**
61
- * A modern manifest.
61
+ * A expo-updates manifest.
62
62
  */
63
- export type NewManifest = {
63
+ export type ExpoUpdatesManifest = {
64
64
  id: string;
65
65
  createdAt: string;
66
66
  runtimeVersion: string;
@@ -71,12 +71,24 @@ export type NewManifest = {
71
71
  };
72
72
 
73
73
  /**
74
- * An embedded bare manifest.
74
+ * @deprecated renamed to ExpoUpdatesManifest, will be removed in a few versions
75
+ * @see ExpoUpdatesManifest
76
+ */
77
+ export type NewManifest = ExpoUpdatesManifest;
78
+
79
+ /**
80
+ * An embedded manifest.
75
81
  *
76
82
  * Generated during build in createManifest.js build step script.
77
83
  */
78
- export type BareManifest = {
84
+ export type EmbeddedManifest = {
79
85
  id: string;
80
86
  commitTime: number;
81
87
  assets: any[]; // intentionally underspecified for now since there are no uses in JS
82
88
  };
89
+
90
+ /**
91
+ * @deprecated renamed to EmbeddedManifest, will be removed in a few versions
92
+ * @see EmbeddedManifest
93
+ */
94
+ export type BareManifest = EmbeddedManifest;
@@ -1,16 +0,0 @@
1
- package expo.modules.manifests.core
2
-
3
- import expo.modules.jsonutils.require
4
- import org.json.JSONException
5
- import org.json.JSONObject
6
-
7
- class BareManifest(json: JSONObject) : BaseLegacyManifest(json) {
8
- /**
9
- * A UUID for this manifest.
10
- */
11
- @Throws(JSONException::class)
12
- fun getID(): String = json.require("id")
13
-
14
- @Throws(JSONException::class)
15
- fun getCommitTimeLong(): Long = json.require("commitTime")
16
- }
@@ -1,22 +0,0 @@
1
- package expo.modules.manifests.core
2
-
3
- import expo.modules.jsonutils.getNullable
4
- import expo.modules.jsonutils.require
5
- import org.json.JSONArray
6
- import org.json.JSONException
7
- import org.json.JSONObject
8
-
9
- open class LegacyManifest(json: JSONObject) : BaseLegacyManifest(json) {
10
- @Throws(JSONException::class)
11
- fun getBundleKey(): String? = json.getNullable("bundleKey")
12
-
13
- @Throws(JSONException::class)
14
- fun getReleaseId(): String = json.require("releaseId")
15
-
16
- fun getRuntimeVersion(): String? = json.getNullable("runtimeVersion")
17
-
18
- @Throws(JSONException::class)
19
- fun getBundledAssets(): JSONArray? = json.getNullable("bundledAssets")
20
-
21
- open fun getAssetUrlOverride(): String? = json.getNullable("assetUrlOverride")
22
- }
@@ -1,19 +0,0 @@
1
- // Copyright © 2021 650 Industries. All rights reserved.
2
-
3
- import Foundation
4
-
5
- @objc(EXManifestsBareManifest)
6
- @objcMembers
7
- public class BareManifest: BaseLegacyManifest {
8
- public func rawId() -> String {
9
- return rawManifestJSON().requiredValue(forKey: "id")
10
- }
11
-
12
- public func commitTimeNumber() -> Int {
13
- return rawManifestJSON().requiredValue(forKey: "commitTime")
14
- }
15
-
16
- public func metadata() -> [String: Any]? {
17
- return rawManifestJSON().optionalValue(forKey: "metadata")
18
- }
19
- }
@@ -1,30 +0,0 @@
1
- // Copyright © 2021 650 Industries. All rights reserved.
2
- import Foundation
3
-
4
- @objc(EXManifestsLegacyManifest)
5
- @objcMembers
6
- public class LegacyManifest: BaseLegacyManifest {
7
- public func releaseID() -> String {
8
- return rawManifestJSON().requiredValue(forKey: "releaseId")
9
- }
10
-
11
- public func commitTime() -> String {
12
- return rawManifestJSON().requiredValue(forKey: "commitTime")
13
- }
14
-
15
- public func bundledAssets() -> [Any]? {
16
- return rawManifestJSON().optionalValue(forKey: "bundledAssets")
17
- }
18
-
19
- public func runtimeVersion() -> Any? {
20
- return rawManifestJSON().optionalValue(forKey: "runtimeVersion")
21
- }
22
-
23
- public func bundleKey() -> String? {
24
- return rawManifestJSON().optionalValue(forKey: "bundleKey")
25
- }
26
-
27
- public func assetUrlOverride() -> String? {
28
- return rawManifestJSON().optionalValue(forKey: "assetUrlOverride")
29
- }
30
- }
@@ -1,68 +0,0 @@
1
- // Copyright (c) 2020 650 Industries, Inc. All rights reserved.
2
-
3
- import ExpoModulesTestCore
4
-
5
- @testable import EXManifests
6
-
7
- class LegacyManifestSpec : ExpoSpec {
8
- override class func spec() {
9
- describe("instantiation") {
10
- it("instantiates and reads properties") {
11
- let manifestJson = "{\"sdkVersion\":\"39.0.0\",\"id\":\"@esamelson/native-component-list\",\"releaseId\":\"0eef8214-4833-4089-9dff-b4138a14f196\",\"commitTime\":\"2020-11-11T00:17:54.797Z\",\"bundleUrl\":\"https://classic-assets.eascdn.net/%40esamelson%2Fnative-component-list%2F39.0.0%2F01c86fd863cfee878068eebd40f165df-39.0.0-ios.js\"}"
12
- let manifestData = manifestJson.data(using: .utf8)
13
- guard let manifestData = manifestData else {
14
- throw ManifestTestError.testError
15
- }
16
- let manifestJsonObject = try JSONSerialization.jsonObject(with: manifestData)
17
- guard let manifestJsonObject = manifestJsonObject as? [String: Any] else {
18
- throw ManifestTestError.testError
19
- }
20
-
21
- let manifest = LegacyManifest(rawManifestJSON: manifestJsonObject)
22
-
23
- expect(manifest.releaseID()) == "0eef8214-4833-4089-9dff-b4138a14f196"
24
- expect(manifest.commitTime()) == "2020-11-11T00:17:54.797Z"
25
- expect(manifest.bundledAssets()).to(beNil())
26
- expect(manifest.runtimeVersion()).to(beNil())
27
- expect(manifest.bundleKey()).to(beNil())
28
- expect(manifest.assetUrlOverride()).to(beNil())
29
-
30
- // from base class
31
- expect(manifest.stableLegacyId()) == "@esamelson/native-component-list"
32
- expect(manifest.scopeKey()) == "@esamelson/native-component-list"
33
- expect(manifest.easProjectId()).to(beNil())
34
- expect(manifest.bundleUrl()) == "https://classic-assets.eascdn.net/%40esamelson%2Fnative-component-list%2F39.0.0%2F01c86fd863cfee878068eebd40f165df-39.0.0-ios.js"
35
- expect(manifest.expoGoSDKVersion()) == "39.0.0"
36
-
37
- // from base base class
38
- expect(manifest.legacyId()) == "@esamelson/native-component-list"
39
- expect(manifest.revisionId()).to(beNil())
40
- expect(manifest.slug()).to(beNil())
41
- expect(manifest.appKey()).to(beNil())
42
- expect(manifest.name()).to(beNil())
43
- expect(manifest.version()).to(beNil())
44
- expect(manifest.notificationPreferences()).to(beNil())
45
- expect(manifest.updatesInfo()).to(beNil())
46
- expect(manifest.iosConfig()).to(beNil())
47
- expect(manifest.hostUri()).to(beNil())
48
- expect(manifest.orientation()).to(beNil())
49
- expect(manifest.experiments()).to(beNil())
50
- expect(manifest.developer()).to(beNil())
51
- expect(manifest.facebookAppId()).to(beNil())
52
- expect(manifest.facebookApplicationName()).to(beNil())
53
- expect(manifest.facebookAutoInitEnabled()) == false
54
- expect(manifest.isDevelopmentMode()) == false
55
- expect(manifest.isDevelopmentSilentLaunch()) == false
56
- expect(manifest.isUsingDeveloperTool()) == false
57
- expect(manifest.userInterfaceStyle()).to(beNil())
58
- expect(manifest.iosOrRootBackgroundColor()).to(beNil())
59
- expect(manifest.iosSplashBackgroundColor()).to(beNil())
60
- expect(manifest.iosSplashImageUrl()).to(beNil())
61
- expect(manifest.iosSplashImageResizeMode()).to(beNil())
62
- expect(manifest.iosGoogleServicesFile()).to(beNil())
63
- expect(manifest.supportsRTL()) == false
64
- expect(manifest.jsEngine()) == "jsc"
65
- }
66
- }
67
- }
68
- }