expo 48.0.19 → 49.0.0-alpha.10

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.
@@ -33,7 +33,7 @@ def getRNVersion() {
33
33
  ensureDependeciesWereEvaluated(project)
34
34
 
35
35
  group = 'host.exp.exponent'
36
- version = '48.0.19'
36
+ version = '49.0.0-alpha.10'
37
37
 
38
38
  buildscript {
39
39
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -65,19 +65,11 @@ buildscript {
65
65
  }
66
66
  }
67
67
 
68
- // Creating sources with comments
69
- task androidSourcesJar(type: Jar) {
70
- classifier = 'sources'
71
- from android.sourceSets.main.java.srcDirs
72
- }
73
-
74
68
  afterEvaluate {
75
69
  publishing {
76
70
  publications {
77
71
  release(MavenPublication) {
78
72
  from components.release
79
- // Add additional sourcesJar to artifacts
80
- artifact(androidSourcesJar)
81
73
  }
82
74
  }
83
75
  repositories {
@@ -100,11 +92,12 @@ android {
100
92
  jvmTarget = JavaVersion.VERSION_11.majorVersion
101
93
  }
102
94
 
95
+ namespace "expo.core"
103
96
  defaultConfig {
104
97
  minSdkVersion safeExtGet("minSdkVersion", 21)
105
98
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
106
99
  versionCode 1
107
- versionName "48.0.19"
100
+ versionName "49.0.0-alpha.10"
108
101
  consumerProguardFiles("proguard-rules.pro")
109
102
  }
110
103
  lintOptions {
@@ -132,13 +125,18 @@ android {
132
125
  }
133
126
  }
134
127
  }
128
+ publishing {
129
+ singleVariant("release") {
130
+ withSourcesJar()
131
+ }
132
+ }
135
133
  }
136
134
 
137
135
  dependencies { dependencyHandler ->
138
136
  //noinspection GradleDynamicVersion
139
137
  implementation 'com.facebook.react:react-native:+'
140
138
 
141
- testImplementation 'junit:junit:4.13.1'
139
+ testImplementation 'junit:junit:4.13.2'
142
140
  testImplementation 'androidx.test:core:1.4.0'
143
141
  testImplementation "com.google.truth:truth:1.1.2"
144
142
  testImplementation 'io.mockk:mockk:1.12.0'
@@ -1,3 +1,3 @@
1
- <manifest package="expo.core">
1
+ <manifest>
2
2
 
3
3
  </manifest>
@@ -34,6 +34,14 @@ class ReactActivityDelegateWrapper(
34
34
  private val reactActivityHandlers = ExpoModulesPackage.packageList
35
35
  .flatMap { it.createReactActivityHandlers(activity) }
36
36
  private val methodMap: ArrayMap<String, Method> = ArrayMap()
37
+ private val host: ReactNativeHost by lazy {
38
+ invokeDelegateMethod("getReactNativeHost")
39
+ }
40
+ /**
41
+ * When the app delay for `loadApp`, the ReactInstanceManager's lifecycle will be disrupted.
42
+ * This flag indicates we should emit `onResume` after `loadApp`.
43
+ */
44
+ private var shouldEmitPendingResume = false
37
45
 
38
46
  //region ReactActivityDelegate
39
47
 
@@ -50,7 +58,7 @@ class ReactActivityDelegateWrapper(
50
58
  }
51
59
 
52
60
  override fun getReactNativeHost(): ReactNativeHost {
53
- return invokeDelegateMethod("getReactNativeHost")
61
+ return host
54
62
  }
55
63
 
56
64
  override fun getReactInstanceManager(): ReactInstanceManager {
@@ -76,9 +84,23 @@ class ReactActivityDelegateWrapper(
76
84
  reactDelegate.loadApp(appKey)
77
85
  rootViewContainer.addView(reactDelegate.reactRootView, ViewGroup.LayoutParams.MATCH_PARENT)
78
86
  activity.setContentView(rootViewContainer)
79
- } else {
80
- return invokeDelegateMethod("loadApp", arrayOf(String::class.java), arrayOf(appKey))
87
+ return
81
88
  }
89
+
90
+ val delayLoadAppHandler = reactActivityHandlers.asSequence()
91
+ .mapNotNull { it.getDelayLoadAppHandler(activity, host) }
92
+ .firstOrNull()
93
+ if (delayLoadAppHandler != null) {
94
+ delayLoadAppHandler.whenReady {
95
+ invokeDelegateMethod<Unit, String?>("loadApp", arrayOf(String::class.java), arrayOf(appKey))
96
+ if (shouldEmitPendingResume) {
97
+ onResume()
98
+ }
99
+ }
100
+ return
101
+ }
102
+
103
+ return invokeDelegateMethod("loadApp", arrayOf(String::class.java), arrayOf(appKey))
82
104
  }
83
105
 
84
106
  override fun onCreate(savedInstanceState: Bundle?) {
@@ -123,13 +145,23 @@ class ReactActivityDelegateWrapper(
123
145
  }
124
146
 
125
147
  override fun onResume() {
148
+ if (!host.hasInstance()) {
149
+ shouldEmitPendingResume = true
150
+ return
151
+ }
126
152
  invokeDelegateMethod<Unit>("onResume")
127
153
  reactActivityLifecycleListeners.forEach { listener ->
128
154
  listener.onResume(activity)
129
155
  }
156
+ shouldEmitPendingResume = false
130
157
  }
131
158
 
132
159
  override fun onPause() {
160
+ // If app is stopped before delayed `loadApp`, we should cancel the pending resume
161
+ shouldEmitPendingResume = false
162
+ if (!host.hasInstance()) {
163
+ return
164
+ }
133
165
  reactActivityLifecycleListeners.forEach { listener ->
134
166
  listener.onPause(activity)
135
167
  }
@@ -137,6 +169,11 @@ class ReactActivityDelegateWrapper(
137
169
  }
138
170
 
139
171
  override fun onDestroy() {
172
+ // If app is stopped before delayed `loadApp`, we should cancel the pending resume
173
+ shouldEmitPendingResume = false
174
+ if (!host.hasInstance()) {
175
+ return
176
+ }
140
177
  reactActivityLifecycleListeners.forEach { listener ->
141
178
  listener.onDestroy(activity)
142
179
  }
@@ -1,5 +1,4 @@
1
- <manifest package="expo.modules.appauth"
2
- xmlns:android="http://schemas.android.com/apk/res/android"
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
2
  xmlns:tools="http://schemas.android.com/tools">
4
3
  <application>
5
4
 
package/bin/cli ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Forward all arguments to the local CLI (@expo/cli).
4
+ npm exec --no-install -- expo-internal "$@"
@@ -15,11 +15,11 @@ if (__DEV__) {
15
15
  if (devServerInfo.bundleLoadedFromServer) {
16
16
  // url: `http://localhost:8081/`
17
17
  const url = !devServerInfo.url.endsWith('/') ? `${devServerInfo.url}/` : devServerInfo.url;
18
- // The standard Expo logUrl is `http://localhost:19000/logs`, this code assumes that the `logs` endpoint doesn't change.
18
+ // The standard Expo logUrl is `http://localhost:8081/logs`, this code assumes that the `logs` endpoint doesn't change.
19
19
  const logUrl = url + 'logs';
20
20
  Constants.__unsafeNoWarnManifest.logUrl = logUrl;
21
- if (Constants.manifest) {
22
- Constants.manifest.logUrl = logUrl;
21
+ if (Constants.expoGoConfig) {
22
+ Constants.expoGoConfig.logUrl = logUrl;
23
23
  }
24
24
  }
25
25
  }
@@ -33,7 +33,7 @@ if (__DEV__) {
33
33
  if (devServerInfo.bundleLoadedFromServer) {
34
34
  // url: `http://localhost:8081/`
35
35
  const url = !devServerInfo.url.endsWith('/') ? `${devServerInfo.url}/` : devServerInfo.url;
36
- // The standard Expo logUrl is `http://localhost:19000/logs`, this code assumes that the `logs` endpoint doesn't change.
36
+ // The standard Expo logUrl is `http://localhost:8081/logs`, this code assumes that the `logs` endpoint doesn't change.
37
37
  const logUrl = url + 'logs';
38
38
  if (Constants.__unsafeNoWarnManifest2.extra?.expoGo) {
39
39
  Constants.__unsafeNoWarnManifest2.extra.expoGo.logUrl = logUrl;
@@ -1 +1 @@
1
- {"version":3,"file":"logging.fx.js","sourceRoot":"","sources":["../../src/environment/logging.fx.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,YAAY,MAAM,mDAAmD,CAAC;AAE7E,sGAAsG;AACtG,IAAI,OAAO,EAAE;IACX,kFAAkF;IAClF,qFAAqF;IACrF;IACE,yGAAyG;IACzG,SAAS,CAAC,sBAAsB;QAChC,2FAA2F;QAC3F,CAAC,SAAS,CAAC,sBAAsB,CAAC,MAAM,EACxC;QACA,MAAM,aAAa,GAAG,YAAY,EAAE,CAAC;QACrC,wDAAwD;QACxD,IAAI,aAAa,CAAC,sBAAsB,EAAE;YACxC,gCAAgC;YAChC,MAAM,GAAG,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG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EACxD;QACA,gGAAgG;QAChG,0GAA0G;QAC1G,IAAI,QAAQ,CAAC,gBAAgB,EAAE;YAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;YAC/D,aAAa,CAAC,qBAAqB,CAAC,MAAM,EAAE,EAAE,EAAE;gBAC9C,uFAAuF;aACxF,CAAC,CAAC;SACJ;aAAM;YACL,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;YACrC,IAAI,CAAC,oBAAoB,EAAE,CAAC;SAC7B;KACF;CACF","sourcesContent":["import Constants from 'expo-constants';\nimport { Platform } from 'expo-modules-core';\nimport getDevServer from 'react-native/Libraries/Core/Devtools/getDevServer';\n\n// Metro and terser don't seem to be capable of shaking the imports unless they're wrapped in __DEV__.\nif (__DEV__) {\n // If the app is being run outside of the Expo Go app and not using expo-dev-menu,\n // then we can attempt to polyfill the `logUrl` to enable console logging in the CLI.\n if (\n // If this is defined then we can be define Constants.manifest.logUrl without worrying about the warning.\n Constants.__unsafeNoWarnManifest &&\n // Only attempt to set the URL if `Constants.__unsafeNoWarnManifest.logUrl` is not defined.\n !Constants.__unsafeNoWarnManifest.logUrl\n ) {\n const devServerInfo = getDevServer();\n // Ensure the URL is remote and not local. i.e `file://`\n if (devServerInfo.bundleLoadedFromServer) {\n // url: `http://localhost:8081/`\n const url = !devServerInfo.url.endsWith('/') ? `${devServerInfo.url}/` : devServerInfo.url;\n // The standard Expo logUrl is `http://localhost:19000/logs`, this code assumes that the `logs` endpoint doesn't change.\n\n const logUrl = url + 'logs';\n Constants.__unsafeNoWarnManifest.logUrl = logUrl;\n if (Constants.manifest) {\n Constants.manifest.logUrl = logUrl;\n }\n }\n } else if (\n // If this is defined then we can be define Constants.manifest2.extra.expoGo.logUrl without worrying about the warning.\n Constants.__unsafeNoWarnManifest2 &&\n // Only attempt to set the URL if `Constants.__unsafeNoWarnManifest2.logUrl` is not defined.\n !Constants.__unsafeNoWarnManifest2.extra?.expoGo?.logUrl\n ) {\n const devServerInfo = getDevServer();\n // Ensure the URL is remote and not local. i.e `file://`\n if (devServerInfo.bundleLoadedFromServer) {\n // url: `http://localhost:8081/`\n const url = !devServerInfo.url.endsWith('/') ? `${devServerInfo.url}/` : devServerInfo.url;\n // The standard Expo logUrl is `http://localhost:19000/logs`, this code assumes that the `logs` endpoint doesn't change.\n\n const logUrl = url + 'logs';\n if (Constants.__unsafeNoWarnManifest2.extra?.expoGo) {\n Constants.__unsafeNoWarnManifest2.extra.expoGo.logUrl = logUrl;\n }\n if (Constants.manifest2?.extra?.expoGo) {\n Constants.manifest2.extra.expoGo.logUrl = logUrl;\n }\n }\n }\n // TODO: Maybe warn that console logging will not be enabled.\n\n if (\n Constants.__unsafeNoWarnManifest?.logUrl ||\n Constants.__unsafeNoWarnManifest2?.extra?.expoGo?.logUrl\n ) {\n // Enable logging to the Expo dev tools only if this JS is not running in a web browser (ex: the\n // remote debugger). In Expo Web we don't show console logs in the CLI, so there's no special case needed.\n if (Platform.isAsyncDebugging) {\n const RemoteLogging = require('../logs/RemoteLogging').default;\n RemoteLogging.enqueueRemoteLogAsync('info', {}, [\n 'You are now debugging remotely; check your browser console for your application logs.',\n ]);\n } else {\n const Logs = require('../logs/Logs');\n Logs.enableExpoCliLogging();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"logging.fx.js","sourceRoot":"","sources":["../../src/environment/logging.fx.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,YAAY,MAAM,mDAAmD,CAAC;AAE7E,sGAAsG;AACtG,IAAI,OAAO,EAAE;IACX,kFAAkF;IAClF,qFAAqF;IACrF;IACE,yGAAyG;IACzG,SAAS,CAAC,sBAAsB;QAChC,2FAA2F;QAC3F,CAAC,SAAS,CAAC,sBAAsB,CAAC,MAAM,EACxC;QACA,MAAM,aAAa,GAAG,YAAY,EAA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,MAAM,CAAC;aAClD;SACF;KACF;IACD,6DAA6D;IAE7D,IACE,SAAS,CAAC,sBAAsB,EAAE,MAAM;QACxC,SAAS,CAAC,uBAAuB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EACxD;QACA,gGAAgG;QAChG,0GAA0G;QAC1G,IAAI,QAAQ,CAAC,gBAAgB,EAAE;YAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;YAC/D,aAAa,CAAC,qBAAqB,CAAC,MAAM,EAAE,EAAE,EAAE;gBAC9C,uFAAuF;aACxF,CAAC,CAAC;SACJ;aAAM;YACL,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;YACrC,IAAI,CAAC,oBAAoB,EAAE,CAAC;SAC7B;KACF;CACF","sourcesContent":["import Constants from 'expo-constants';\nimport { Platform } from 'expo-modules-core';\nimport getDevServer from 'react-native/Libraries/Core/Devtools/getDevServer';\n\n// Metro and terser don't seem to be capable of shaking the imports unless they're wrapped in __DEV__.\nif (__DEV__) {\n // If the app is being run outside of the Expo Go app and not using expo-dev-menu,\n // then we can attempt to polyfill the `logUrl` to enable console logging in the CLI.\n if (\n // If this is defined then we can be define Constants.manifest.logUrl without worrying about the warning.\n Constants.__unsafeNoWarnManifest &&\n // Only attempt to set the URL if `Constants.__unsafeNoWarnManifest.logUrl` is not defined.\n !Constants.__unsafeNoWarnManifest.logUrl\n ) {\n const devServerInfo = getDevServer();\n // Ensure the URL is remote and not local. i.e `file://`\n if (devServerInfo.bundleLoadedFromServer) {\n // url: `http://localhost:8081/`\n const url = !devServerInfo.url.endsWith('/') ? `${devServerInfo.url}/` : devServerInfo.url;\n // The standard Expo logUrl is `http://localhost:8081/logs`, this code assumes that the `logs` endpoint doesn't change.\n\n const logUrl = url + 'logs';\n Constants.__unsafeNoWarnManifest.logUrl = logUrl;\n if (Constants.expoGoConfig) {\n Constants.expoGoConfig.logUrl = logUrl;\n }\n }\n } else if (\n // If this is defined then we can be define Constants.manifest2.extra.expoGo.logUrl without worrying about the warning.\n Constants.__unsafeNoWarnManifest2 &&\n // Only attempt to set the URL if `Constants.__unsafeNoWarnManifest2.logUrl` is not defined.\n !Constants.__unsafeNoWarnManifest2.extra?.expoGo?.logUrl\n ) {\n const devServerInfo = getDevServer();\n // Ensure the URL is remote and not local. i.e `file://`\n if (devServerInfo.bundleLoadedFromServer) {\n // url: `http://localhost:8081/`\n const url = !devServerInfo.url.endsWith('/') ? `${devServerInfo.url}/` : devServerInfo.url;\n // The standard Expo logUrl is `http://localhost:8081/logs`, this code assumes that the `logs` endpoint doesn't change.\n\n const logUrl = url + 'logs';\n if (Constants.__unsafeNoWarnManifest2.extra?.expoGo) {\n Constants.__unsafeNoWarnManifest2.extra.expoGo.logUrl = logUrl;\n }\n if (Constants.manifest2?.extra?.expoGo) {\n Constants.manifest2.extra.expoGo.logUrl = logUrl;\n }\n }\n }\n // TODO: Maybe warn that console logging will not be enabled.\n\n if (\n Constants.__unsafeNoWarnManifest?.logUrl ||\n Constants.__unsafeNoWarnManifest2?.extra?.expoGo?.logUrl\n ) {\n // Enable logging to the Expo dev tools only if this JS is not running in a web browser (ex: the\n // remote debugger). In Expo Web we don't show console logs in the CLI, so there's no special case needed.\n if (Platform.isAsyncDebugging) {\n const RemoteLogging = require('../logs/RemoteLogging').default;\n RemoteLogging.enqueueRemoteLogAsync('info', {}, [\n 'You are now debugging remotely; check your browser console for your application logs.',\n ]);\n } else {\n const Logs = require('../logs/Logs');\n Logs.enableExpoCliLogging();\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LogSerialization.d.ts","sourceRoot":"","sources":["../../src/logs/LogSerialization.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAE3D,iBAAe,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CAqD9F;;;;AAwID,wBAEE"}
1
+ {"version":3,"file":"LogSerialization.d.ts","sourceRoot":"","sources":["../../src/logs/LogSerialization.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAE3D,iBAAe,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CAqD9F;;;;AAoID,wBAEE"}
@@ -166,9 +166,7 @@ function _captureConsoleStackTrace() {
166
166
  }
167
167
  }
168
168
  function _getProjectRoot() {
169
- return (Constants.manifest?.developer?.projectRoot ??
170
- Constants.manifest2?.extra?.expoGo?.developer?.projectRoot ??
171
- null);
169
+ return Constants.expoGoConfig?.developer?.projectRoot ?? null;
172
170
  }
173
171
  export default {
174
172
  serializeLogDataAsync,
@@ -1 +1 @@
1
- {"version":3,"file":"LogSerialization.js","sourceRoot":"","sources":["../../src/logs/LogSerialization.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,eAA+B,MAAM,sDAAsD,CAAC;AACnG,OAAO,qBAAqB,MAAM,4DAA4D,CAAC;AAG/F,OAAO,kBAAkB,MAAM,6BAA6B,CAAC;AAO7D,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE3D,KAAK,UAAU,qBAAqB,CAAC,IAAe,EAAE,K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AC,QAAQ,CAAC,wBAAwB,CAAC,CACzC,CAAC;QACF,IAAI,kBAAkB,KAAK,CAAC,CAAC,EAAE;YAC7B,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC;YACtD,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrC;QACD,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,CACL,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW;QAC1C,SAAS,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW;QAC1D,IAAI,CACL,CAAC;AACJ,CAAC;AAED,eAAe;IACb,qBAAqB;CACtB,CAAC","sourcesContent":["import Constants from 'expo-constants';\nimport prettyFormat from 'pretty-format';\nimport parseErrorStack, { StackFrame } from 'react-native/Libraries/Core/Devtools/parseErrorStack';\nimport symbolicateStackTrace from 'react-native/Libraries/Core/Devtools/symbolicateStackTrace';\n\nimport { LogData, LogLevel } from './RemoteLogging';\nimport ReactNodeFormatter from './format/ReactNodeFormatter';\n\ntype SerializedData = {\n body: LogData[];\n includesStack: boolean;\n};\n\nexport const EXPO_CONSOLE_METHOD_NAME = '__expoConsoleLog';\n\nasync function serializeLogDataAsync(data: unknown[], level: LogLevel): Promise<SerializedData> {\n let serializedValues: readonly LogData[];\n let includesStack = false;\n\n if (_stackTraceLogsSupported()) {\n if (_isUnhandledPromiseRejection(data, level)) {\n const rawStack = data[0] as string;\n const syntheticError = { stack: rawStack };\n const stack = await _symbolicateErrorAsync(syntheticError as Error);\n\n if (!stack.length) {\n serializedValues = _stringifyLogData(data);\n } else {\n // NOTE: This doesn't handle error messages with newlines\n const errorMessage = rawStack.split('\\n')[1];\n serializedValues = [\n {\n message: `[Unhandled promise rejection: ${errorMessage}]`,\n stack: _formatStack(stack),\n },\n ];\n includesStack = true;\n }\n } else if (data.length === 1 && data[0] instanceof Error) {\n // When there's only one argument to the log function and that argument is an error, we\n // include the error's stack. If there's more than one argument then we don't include the\n // stack because it's not easy to display nicely in our current UI.\n\n const serializedError = await _serializeErrorAsync(data[0] as Error);\n serializedValues = [serializedError];\n includesStack = serializedError.hasOwnProperty('stack');\n } else if (level === 'warn' || level === 'error') {\n // For console.warn and console.error it is usually useful to know the stack that leads to the\n // warning or error, so we provide this information to help out with debugging\n\n const error = _captureConsoleStackTrace();\n // [\"hello\", \"world\"] becomes \"hello, world\"\n const errorMessage = _stringifyLogData(data).join(', ');\n\n const serializedError = await _serializeErrorAsync(error, errorMessage);\n serializedValues = [serializedError];\n includesStack = serializedError.hasOwnProperty('stack');\n } else {\n serializedValues = _stringifyLogData(data);\n }\n } else {\n serializedValues = _stringifyLogData(data);\n }\n\n return {\n body: [...serializedValues],\n includesStack,\n };\n}\n\nfunction _stringifyLogData(data: unknown[]): string[] {\n return data.map((item) => {\n // define the max length for log msg to be first 10000 characters\n const LOG_MESSAGE_MAX_LENGTH = 10000;\n const result =\n typeof item === 'string' ? item : prettyFormat(item, { plugins: [ReactNodeFormatter] });\n // check the size of string returned\n if (result.length > LOG_MESSAGE_MAX_LENGTH) {\n let truncatedResult = result.substring(0, LOG_MESSAGE_MAX_LENGTH);\n // truncate the result string to the max length\n truncatedResult += `...(truncated to the first ${LOG_MESSAGE_MAX_LENGTH} characters)`;\n return truncatedResult;\n } else {\n return result;\n }\n });\n}\n\nasync function _serializeErrorAsync(error: Error, message?: string): Promise<LogData> {\n if (message == null) {\n message = error.message;\n }\n\n if (!error.stack || !error.stack.length) {\n return prettyFormat(error);\n }\n\n const stack = await _symbolicateErrorAsync(error);\n const formattedStack = _formatStack(stack);\n\n return { message, stack: formattedStack };\n}\n\nasync function _symbolicateErrorAsync(error: Error): Promise<StackFrame[]> {\n // @ts-ignore: parseErrorStack accepts nullable string after RN 0.64 but @types/react-native does not updated yet.\n const parsedStack = parseErrorStack(error?.stack);\n let symbolicatedStack: StackFrame[] | null;\n try {\n // @ts-ignore: symbolicateStackTrace has different real/Flow declaration\n // than the one in DefinitelyTyped.\n symbolicatedStack = (await symbolicateStackTrace(parsedStack))?.stack ?? null;\n } catch {\n return parsedStack;\n }\n\n // In this context an unsymbolicated stack is better than no stack\n if (!symbolicatedStack) {\n return parsedStack;\n }\n\n // Clean the stack trace\n return symbolicatedStack.map(_removeProjectRoot);\n}\n\nfunction _formatStack(stack: StackFrame[]): string {\n return stack\n .map((frame) => {\n let line = `${frame.file}:${frame.lineNumber}`;\n if (frame.column != null) {\n line += `:${frame.column}`;\n }\n line += ` in ${frame.methodName}`;\n return line;\n })\n .join('\\n');\n}\n\nfunction _removeProjectRoot(frame: StackFrame): StackFrame {\n let filename = frame.file;\n if (filename == null) {\n return frame;\n }\n\n const projectRoot = _getProjectRoot();\n if (projectRoot == null) {\n return frame;\n }\n\n if (filename.startsWith(projectRoot)) {\n filename = filename.substring(projectRoot.length);\n if (filename[0] === '/' || filename[0] === '\\\\') {\n filename = filename.substring(1);\n }\n frame.file = filename;\n }\n\n return frame;\n}\n\n/**\n * Returns whether the development server that served this project supports logs with a stack trace.\n * Specifically, the version of Expo CLI that includes `projectRoot` in the manifest also accepts\n * payloads of the form:\n *\n * {\n * includesStack: boolean, body: [{ message: string, stack: string }],\n * }\n */\nfunction _stackTraceLogsSupported(): boolean {\n return !!(__DEV__ && _getProjectRoot());\n}\n\nfunction _isUnhandledPromiseRejection(data: unknown[], level: LogLevel): boolean {\n return (\n level === 'warn' &&\n typeof data[0] === 'string' &&\n /^Possible Unhandled Promise Rejection/.test(data[0] as string)\n );\n}\n\nfunction _captureConsoleStackTrace(): Error {\n try {\n throw new Error();\n } catch (error) {\n let stackLines = error.stack.split('\\n');\n const consoleMethodIndex = stackLines.findIndex((frame) =>\n frame.includes(EXPO_CONSOLE_METHOD_NAME)\n );\n if (consoleMethodIndex !== -1) {\n stackLines = stackLines.slice(consoleMethodIndex + 1);\n error.stack = stackLines.join('\\n');\n }\n return error;\n }\n}\n\nfunction _getProjectRoot(): string | null {\n return (\n Constants.manifest?.developer?.projectRoot ??\n Constants.manifest2?.extra?.expoGo?.developer?.projectRoot ??\n null\n );\n}\n\nexport default {\n serializeLogDataAsync,\n};\n"]}
1
+ {"version":3,"file":"LogSerialization.js","sourceRoot":"","sources":["../../src/logs/LogSerialization.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,eAA+B,MAAM,sDAAsD,CAAC;AACnG,OAAO,qBAAqB,MAAM,4DAA4D,CAAC;AAG/F,OAAO,kBAAkB,MAAM,6BAA6B,CAAC;AAO7D,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE3D,KAAK,UAAU,qBAAqB,CAAC,IAAe,EAAE,KAAe;IACnE,IAAI,gBAAoC,CAAC;IACzC,IAAI,aAAa,GAAG,KAAK,CAAC;IAE1B,IAAI,wBAAwB,EAAE,EAAE;QAC9B,IAAI,4BAA4B,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;YAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAW,CAAC;YACnC,MAAM,cAAc,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;YAC3C,MAAM,KAAK,GAAG,MAAM,sBAAsB,CAAC,cAAuB,CAAC,CAAC;YAEpE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBACjB,gBAAgB,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;aAC5C;iBAAM;gBACL,yDAAyD;gBACzD,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7C,gBAAgB,GAAG;oBACjB;wBACE,OAAO,EAAE,iCAAiC,YAAY,GAAG;wBACzD,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;qBAC3B;iBACF,CAAC;gBACF,aAAa,GAA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C,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,4BAA4B,CAAC,IAAe,EAAE,KAAe;IACpE,OAAO,CACL,KAAK,KAAK,MAAM;QAChB,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ;QAC3B,uCAAuC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAW,CAAC,CAChE,CAAC;AACJ,CAAC;AAED,SAAS,yBAAyB;IAChC,IAAI;QACF,MAAM,IAAI,KAAK,EAAE,CAAC;KACnB;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CACxD,KAAK,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CACzC,CAAC;QACF,IAAI,kBAAkB,KAAK,CAAC,CAAC,EAAE;YAC7B,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC;YACtD,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrC;QACD,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,IAAI,IAAI,CAAC;AAChE,CAAC;AAED,eAAe;IACb,qBAAqB;CACtB,CAAC","sourcesContent":["import Constants from 'expo-constants';\nimport prettyFormat from 'pretty-format';\nimport parseErrorStack, { StackFrame } from 'react-native/Libraries/Core/Devtools/parseErrorStack';\nimport symbolicateStackTrace from 'react-native/Libraries/Core/Devtools/symbolicateStackTrace';\n\nimport { LogData, LogLevel } from './RemoteLogging';\nimport ReactNodeFormatter from './format/ReactNodeFormatter';\n\ntype SerializedData = {\n body: LogData[];\n includesStack: boolean;\n};\n\nexport const EXPO_CONSOLE_METHOD_NAME = '__expoConsoleLog';\n\nasync function serializeLogDataAsync(data: unknown[], level: LogLevel): Promise<SerializedData> {\n let serializedValues: readonly LogData[];\n let includesStack = false;\n\n if (_stackTraceLogsSupported()) {\n if (_isUnhandledPromiseRejection(data, level)) {\n const rawStack = data[0] as string;\n const syntheticError = { stack: rawStack };\n const stack = await _symbolicateErrorAsync(syntheticError as Error);\n\n if (!stack.length) {\n serializedValues = _stringifyLogData(data);\n } else {\n // NOTE: This doesn't handle error messages with newlines\n const errorMessage = rawStack.split('\\n')[1];\n serializedValues = [\n {\n message: `[Unhandled promise rejection: ${errorMessage}]`,\n stack: _formatStack(stack),\n },\n ];\n includesStack = true;\n }\n } else if (data.length === 1 && data[0] instanceof Error) {\n // When there's only one argument to the log function and that argument is an error, we\n // include the error's stack. If there's more than one argument then we don't include the\n // stack because it's not easy to display nicely in our current UI.\n\n const serializedError = await _serializeErrorAsync(data[0] as Error);\n serializedValues = [serializedError];\n includesStack = serializedError.hasOwnProperty('stack');\n } else if (level === 'warn' || level === 'error') {\n // For console.warn and console.error it is usually useful to know the stack that leads to the\n // warning or error, so we provide this information to help out with debugging\n\n const error = _captureConsoleStackTrace();\n // [\"hello\", \"world\"] becomes \"hello, world\"\n const errorMessage = _stringifyLogData(data).join(', ');\n\n const serializedError = await _serializeErrorAsync(error, errorMessage);\n serializedValues = [serializedError];\n includesStack = serializedError.hasOwnProperty('stack');\n } else {\n serializedValues = _stringifyLogData(data);\n }\n } else {\n serializedValues = _stringifyLogData(data);\n }\n\n return {\n body: [...serializedValues],\n includesStack,\n };\n}\n\nfunction _stringifyLogData(data: unknown[]): string[] {\n return data.map((item) => {\n // define the max length for log msg to be first 10000 characters\n const LOG_MESSAGE_MAX_LENGTH = 10000;\n const result =\n typeof item === 'string' ? item : prettyFormat(item, { plugins: [ReactNodeFormatter] });\n // check the size of string returned\n if (result.length > LOG_MESSAGE_MAX_LENGTH) {\n let truncatedResult = result.substring(0, LOG_MESSAGE_MAX_LENGTH);\n // truncate the result string to the max length\n truncatedResult += `...(truncated to the first ${LOG_MESSAGE_MAX_LENGTH} characters)`;\n return truncatedResult;\n } else {\n return result;\n }\n });\n}\n\nasync function _serializeErrorAsync(error: Error, message?: string): Promise<LogData> {\n if (message == null) {\n message = error.message;\n }\n\n if (!error.stack || !error.stack.length) {\n return prettyFormat(error);\n }\n\n const stack = await _symbolicateErrorAsync(error);\n const formattedStack = _formatStack(stack);\n\n return { message, stack: formattedStack };\n}\n\nasync function _symbolicateErrorAsync(error: Error): Promise<StackFrame[]> {\n // @ts-ignore: parseErrorStack accepts nullable string after RN 0.64 but @types/react-native does not updated yet.\n const parsedStack = parseErrorStack(error?.stack);\n let symbolicatedStack: StackFrame[] | null;\n try {\n // @ts-ignore: symbolicateStackTrace has different real/Flow declaration\n // than the one in DefinitelyTyped.\n symbolicatedStack = (await symbolicateStackTrace(parsedStack))?.stack ?? null;\n } catch {\n return parsedStack;\n }\n\n // In this context an unsymbolicated stack is better than no stack\n if (!symbolicatedStack) {\n return parsedStack;\n }\n\n // Clean the stack trace\n return symbolicatedStack.map(_removeProjectRoot);\n}\n\nfunction _formatStack(stack: StackFrame[]): string {\n return stack\n .map((frame) => {\n let line = `${frame.file}:${frame.lineNumber}`;\n if (frame.column != null) {\n line += `:${frame.column}`;\n }\n line += ` in ${frame.methodName}`;\n return line;\n })\n .join('\\n');\n}\n\nfunction _removeProjectRoot(frame: StackFrame): StackFrame {\n let filename = frame.file;\n if (filename == null) {\n return frame;\n }\n\n const projectRoot = _getProjectRoot();\n if (projectRoot == null) {\n return frame;\n }\n\n if (filename.startsWith(projectRoot)) {\n filename = filename.substring(projectRoot.length);\n if (filename[0] === '/' || filename[0] === '\\\\') {\n filename = filename.substring(1);\n }\n frame.file = filename;\n }\n\n return frame;\n}\n\n/**\n * Returns whether the development server that served this project supports logs with a stack trace.\n * Specifically, the version of Expo CLI that includes `projectRoot` in the manifest also accepts\n * payloads of the form:\n *\n * {\n * includesStack: boolean, body: [{ message: string, stack: string }],\n * }\n */\nfunction _stackTraceLogsSupported(): boolean {\n return !!(__DEV__ && _getProjectRoot());\n}\n\nfunction _isUnhandledPromiseRejection(data: unknown[], level: LogLevel): boolean {\n return (\n level === 'warn' &&\n typeof data[0] === 'string' &&\n /^Possible Unhandled Promise Rejection/.test(data[0] as string)\n );\n}\n\nfunction _captureConsoleStackTrace(): Error {\n try {\n throw new Error();\n } catch (error) {\n let stackLines = error.stack.split('\\n');\n const consoleMethodIndex = stackLines.findIndex((frame) =>\n frame.includes(EXPO_CONSOLE_METHOD_NAME)\n );\n if (consoleMethodIndex !== -1) {\n stackLines = stackLines.slice(consoleMethodIndex + 1);\n error.stack = stackLines.join('\\n');\n }\n return error;\n }\n}\n\nfunction _getProjectRoot(): string | null {\n return Constants.expoGoConfig?.developer?.projectRoot ?? null;\n}\n\nexport default {\n serializeLogDataAsync,\n};\n"]}
@@ -49,7 +49,7 @@ async function _sendRemoteLogsAsync() {
49
49
  // Our current transport policy is to send all of the pending log messages in one batch. If we opt
50
50
  // for another policy (ex: throttling) this is where to to implement it.
51
51
  const batch = _logQueue.splice(0);
52
- const logUrl = Constants.manifest?.logUrl ?? Constants.manifest2?.extra?.expoGo?.logUrl;
52
+ const logUrl = Constants.expoGoConfig?.logUrl;
53
53
  if (typeof logUrl !== 'string') {
54
54
  throw new Error('The Expo project manifest must specify `logUrl`');
55
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteLogging.js","sourceRoot":"","sources":["../../src/logs/RemoteLogging.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAqB,MAAM,WAAW,CAAC;AAC5D,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,sBAAsB,MAAM,uCAAuC,C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BAAkB,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3C,kBAAkB,GAAG,GAAG,EAAE;YACxB,SAAS,CAAC,CAAC,cAAc,EAAE,wCAAwC,CAAC,CAAC;YACrE,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,uCAAuC,CAAC,CAAC;YAEtE,kBAAkB,GAAG,IAAI,CAAC;YAC1B,kBAAkB,GAAG,IAAI,CAAC;YAE1B,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,kBAAkB,CAAC;AAC5B,CAAC","sourcesContent":["import Constants from 'expo-constants';\nimport { Platform } from 'expo-modules-core';\nimport { EventEmitter, EventSubscription } from 'fbemitter';\nimport invariant from 'invariant';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport getInstallationIdAsync from '../environment/getInstallationIdAsync';\nimport LogSerialization from './LogSerialization';\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\ntype LogEntry = {\n count: number;\n level: LogLevel;\n body: LogData[];\n includesStack: boolean;\n groupDepth?: number;\n} & LogEntryFields;\n\nexport type LogEntryFields = {\n shouldHide?: boolean;\n groupDepth?: number;\n groupCollapsed?: boolean;\n};\n\nexport type LogData = string | LogErrorData;\nexport type LogErrorData = { message: string; stack: string };\n\ntype TransportErrorListener = (event: { error: Error; response?: Response }) => void;\n\nconst _sessionId = uuidv4();\nconst _logQueue: LogEntry[] = [];\nconst _transportEventEmitter = new EventEmitter();\n\nlet _logCounter = 0;\nlet _isSendingLogs = false;\nlet _completionPromise: Promise<void> | null = null;\nlet _resolveCompletion: (() => void) | null = null;\n\nasync function enqueueRemoteLogAsync(\n level: LogLevel,\n additionalFields: LogEntryFields,\n data: unknown[]\n): Promise<void> {\n if (_isReactNativeWarning(data)) {\n // Remove the stack trace from the warning message since we'll capture our own\n if (data.length === 0) {\n throw new Error(`Warnings must include log arguments`);\n }\n const warning = data[0];\n if (typeof warning !== 'string') {\n throw new TypeError(`The log argument for a warning must be a string`);\n }\n const lines = warning.split('\\n');\n if (lines.length > 1 && /^\\s+in /.test(lines[1])) {\n data[0] = lines[0];\n }\n }\n\n const { body, includesStack } = await LogSerialization.serializeLogDataAsync(data, level);\n\n _logQueue.push({\n count: _logCounter++,\n level,\n body,\n includesStack,\n ...additionalFields,\n });\n\n // Send the logs asynchronously (system errors are emitted with transport error events) and throw an uncaught error\n _sendRemoteLogsAsync().catch((error) => {\n setImmediate(() => {\n throw error;\n });\n });\n}\n\nasync function _sendRemoteLogsAsync(): Promise<void> {\n if (_isSendingLogs || !_logQueue.length) {\n return;\n }\n\n // Our current transport policy is to send all of the pending log messages in one batch. If we opt\n // for another policy (ex: throttling) this is where to to implement it.\n const batch = _logQueue.splice(0);\n\n const logUrl = Constants.manifest?.logUrl ?? Constants.manifest2?.extra?.expoGo?.logUrl;\n if (typeof logUrl !== 'string') {\n throw new Error('The Expo project manifest must specify `logUrl`');\n }\n\n _isSendingLogs = true;\n try {\n await _sendNextLogBatchAsync(batch, logUrl);\n } finally {\n _isSendingLogs = false;\n }\n\n if (_logQueue.length) {\n return _sendRemoteLogsAsync();\n } else if (_resolveCompletion) {\n _resolveCompletion();\n }\n}\n\nasync function _sendNextLogBatchAsync(batch: LogEntry[], logUrl: string): Promise<void> {\n let response;\n\n const headers = {\n 'Content-Type': 'application/json',\n Connection: 'keep-alive',\n 'Proxy-Connection': 'keep-alive',\n Accept: 'application/json',\n 'Device-Id': await getInstallationIdAsync(),\n 'Session-Id': _sessionId,\n 'Expo-Platform': Platform.OS,\n };\n if (Constants.deviceName) {\n headers['Device-Name'] = Constants.deviceName;\n }\n try {\n response = await fetch(logUrl, {\n method: 'POST',\n headers,\n body: JSON.stringify(batch),\n });\n } catch (error) {\n _transportEventEmitter.emit('error', { error });\n return;\n }\n\n const success = response.status >= 200 && response.status < 300;\n if (!success) {\n _transportEventEmitter.emit('error', {\n error: new Error(`An HTTP error occurred when sending remote logs`),\n response,\n });\n }\n}\n\nfunction addTransportErrorListener(listener: TransportErrorListener): EventSubscription {\n return _transportEventEmitter.addListener('error', listener);\n}\n\nfunction _isReactNativeWarning(data: unknown[]): boolean {\n // NOTE: RN does the same thing internally for YellowBox\n const message = data[0];\n return data.length === 1 && typeof message === 'string' && message.startsWith('Warning: ');\n}\n\nexport default {\n enqueueRemoteLogAsync,\n addTransportErrorListener,\n};\n\n/**\n * Returns a promise that resolves when all entries in the log queue have been sent. This method is\n * intended for testing only.\n */\nexport function __waitForEmptyLogQueueAsync(): Promise<void> {\n if (_completionPromise) {\n return _completionPromise;\n }\n\n if (!_isSendingLogs && !_logQueue.length) {\n return Promise.resolve();\n }\n\n _completionPromise = new Promise((resolve) => {\n _resolveCompletion = () => {\n invariant(!_isSendingLogs, `Must not be sending logs at completion`);\n invariant(!_logQueue.length, `Log queue must be empty at completion`);\n\n _completionPromise = null;\n _resolveCompletion = null;\n\n resolve();\n };\n });\n return _completionPromise;\n}\n"]}
1
+ {"version":3,"file":"RemoteLogging.js","sourceRoot":"","sources":["../../src/logs/RemoteLogging.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAqB,MAAM,WAAW,CAAC;AAC5D,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAuBlD,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAC5B,MAAM,SAAS,GAAe,EAAE,CAAC;AACjC,MAAM,sBAAsB,GAAG,IAAI,YAAY,EAAE,CAAC;AAElD,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,cAAc,GAAG,KAAK,CAAC;AAC3B,IAAI,kBAAkB,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AC,CAAC,CAAC;IACH,OAAO,kBAAkB,CAAC;AAC5B,CAAC","sourcesContent":["import Constants from 'expo-constants';\nimport { Platform } from 'expo-modules-core';\nimport { EventEmitter, EventSubscription } from 'fbemitter';\nimport invariant from 'invariant';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport getInstallationIdAsync from '../environment/getInstallationIdAsync';\nimport LogSerialization from './LogSerialization';\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\ntype LogEntry = {\n count: number;\n level: LogLevel;\n body: LogData[];\n includesStack: boolean;\n groupDepth?: number;\n} & LogEntryFields;\n\nexport type LogEntryFields = {\n shouldHide?: boolean;\n groupDepth?: number;\n groupCollapsed?: boolean;\n};\n\nexport type LogData = string | LogErrorData;\nexport type LogErrorData = { message: string; stack: string };\n\ntype TransportErrorListener = (event: { error: Error; response?: Response }) => void;\n\nconst _sessionId = uuidv4();\nconst _logQueue: LogEntry[] = [];\nconst _transportEventEmitter = new EventEmitter();\n\nlet _logCounter = 0;\nlet _isSendingLogs = false;\nlet _completionPromise: Promise<void> | null = null;\nlet _resolveCompletion: (() => void) | null = null;\n\nasync function enqueueRemoteLogAsync(\n level: LogLevel,\n additionalFields: LogEntryFields,\n data: unknown[]\n): Promise<void> {\n if (_isReactNativeWarning(data)) {\n // Remove the stack trace from the warning message since we'll capture our own\n if (data.length === 0) {\n throw new Error(`Warnings must include log arguments`);\n }\n const warning = data[0];\n if (typeof warning !== 'string') {\n throw new TypeError(`The log argument for a warning must be a string`);\n }\n const lines = warning.split('\\n');\n if (lines.length > 1 && /^\\s+in /.test(lines[1])) {\n data[0] = lines[0];\n }\n }\n\n const { body, includesStack } = await LogSerialization.serializeLogDataAsync(data, level);\n\n _logQueue.push({\n count: _logCounter++,\n level,\n body,\n includesStack,\n ...additionalFields,\n });\n\n // Send the logs asynchronously (system errors are emitted with transport error events) and throw an uncaught error\n _sendRemoteLogsAsync().catch((error) => {\n setImmediate(() => {\n throw error;\n });\n });\n}\n\nasync function _sendRemoteLogsAsync(): Promise<void> {\n if (_isSendingLogs || !_logQueue.length) {\n return;\n }\n\n // Our current transport policy is to send all of the pending log messages in one batch. If we opt\n // for another policy (ex: throttling) this is where to to implement it.\n const batch = _logQueue.splice(0);\n\n const logUrl = Constants.expoGoConfig?.logUrl;\n if (typeof logUrl !== 'string') {\n throw new Error('The Expo project manifest must specify `logUrl`');\n }\n\n _isSendingLogs = true;\n try {\n await _sendNextLogBatchAsync(batch, logUrl);\n } finally {\n _isSendingLogs = false;\n }\n\n if (_logQueue.length) {\n return _sendRemoteLogsAsync();\n } else if (_resolveCompletion) {\n _resolveCompletion();\n }\n}\n\nasync function _sendNextLogBatchAsync(batch: LogEntry[], logUrl: string): Promise<void> {\n let response;\n\n const headers = {\n 'Content-Type': 'application/json',\n Connection: 'keep-alive',\n 'Proxy-Connection': 'keep-alive',\n Accept: 'application/json',\n 'Device-Id': await getInstallationIdAsync(),\n 'Session-Id': _sessionId,\n 'Expo-Platform': Platform.OS,\n };\n if (Constants.deviceName) {\n headers['Device-Name'] = Constants.deviceName;\n }\n try {\n response = await fetch(logUrl, {\n method: 'POST',\n headers,\n body: JSON.stringify(batch),\n });\n } catch (error) {\n _transportEventEmitter.emit('error', { error });\n return;\n }\n\n const success = response.status >= 200 && response.status < 300;\n if (!success) {\n _transportEventEmitter.emit('error', {\n error: new Error(`An HTTP error occurred when sending remote logs`),\n response,\n });\n }\n}\n\nfunction addTransportErrorListener(listener: TransportErrorListener): EventSubscription {\n return _transportEventEmitter.addListener('error', listener);\n}\n\nfunction _isReactNativeWarning(data: unknown[]): boolean {\n // NOTE: RN does the same thing internally for YellowBox\n const message = data[0];\n return data.length === 1 && typeof message === 'string' && message.startsWith('Warning: ');\n}\n\nexport default {\n enqueueRemoteLogAsync,\n addTransportErrorListener,\n};\n\n/**\n * Returns a promise that resolves when all entries in the log queue have been sent. This method is\n * intended for testing only.\n */\nexport function __waitForEmptyLogQueueAsync(): Promise<void> {\n if (_completionPromise) {\n return _completionPromise;\n }\n\n if (!_isSendingLogs && !_logQueue.length) {\n return Promise.resolve();\n }\n\n _completionPromise = new Promise((resolve) => {\n _resolveCompletion = () => {\n invariant(!_isSendingLogs, `Must not be sending logs at completion`);\n invariant(!_logQueue.length, `Log queue must be empty at completion`);\n\n _completionPromise = null;\n _resolveCompletion = null;\n\n resolve();\n };\n });\n return _completionPromise;\n}\n"]}
@@ -1,105 +1,105 @@
1
1
  {
2
2
  "@expo/vector-icons": "^13.0.0",
3
- "@react-native-async-storage/async-storage": "1.17.11",
4
- "@react-native-community/datetimepicker": "6.7.3",
5
- "@react-native-masked-view/masked-view": "0.2.8",
6
- "@react-native-community/netinfo": "9.3.7",
3
+ "@react-native-async-storage/async-storage": "1.18.2",
4
+ "@react-native-community/datetimepicker": "7.2.0",
5
+ "@react-native-masked-view/masked-view": "0.2.9",
6
+ "@react-native-community/netinfo": "9.3.10",
7
7
  "@react-native-community/slider": "4.4.2",
8
8
  "@react-native-community/viewpager": "5.0.11",
9
- "@react-native-picker/picker": "2.4.8",
10
- "@react-native-segmented-control/segmented-control": "2.4.0",
11
- "@stripe/stripe-react-native": "0.23.3",
9
+ "@react-native-picker/picker": "2.4.10",
10
+ "@react-native-segmented-control/segmented-control": "2.4.1",
11
+ "@stripe/stripe-react-native": "0.28.0",
12
12
  "expo-analytics-amplitude": "~11.3.0",
13
13
  "expo-app-auth": "~11.1.0",
14
14
  "expo-app-loader-provider": "~8.0.0",
15
- "expo-apple-authentication": "~6.0.1",
16
- "expo-application": "~5.1.1",
17
- "expo-asset": "~8.9.1",
18
- "expo-auth-session": "~4.0.3",
19
- "expo-av": "~13.2.1",
20
- "expo-background-fetch": "~11.1.1",
21
- "expo-barcode-scanner": "~12.3.2",
22
- "expo-battery": "~7.1.1",
23
- "expo-blur": "~12.2.2",
24
- "expo-brightness": "~11.2.1",
25
- "expo-build-properties": "~0.6.0",
26
- "expo-calendar": "~11.1.1",
27
- "expo-camera": "~13.2.1",
28
- "expo-cellular": "~5.1.1",
29
- "expo-checkbox": "~2.3.1",
30
- "expo-clipboard": "~4.1.2",
31
- "expo-constants": "~14.2.1",
32
- "expo-contacts": "~12.0.1",
33
- "expo-crypto": "~12.2.1",
34
- "expo-dev-client": "~2.2.1",
35
- "expo-device": "~5.2.1",
36
- "expo-document-picker": "~11.2.2",
37
- "expo-face-detector": "~12.1.1",
38
- "expo-file-system": "~15.2.2",
39
- "expo-font": "~11.1.1",
40
- "expo-gl": "~12.4.0",
15
+ "expo-apple-authentication": "~6.1.0",
16
+ "expo-application": "~5.3.0",
17
+ "expo-asset": "~8.10.1",
18
+ "expo-auth-session": "~5.0.1",
19
+ "expo-av": "~13.4.0",
20
+ "expo-background-fetch": "~11.3.0",
21
+ "expo-barcode-scanner": "~12.5.1",
22
+ "expo-battery": "~7.3.0",
23
+ "expo-blur": "~12.4.1",
24
+ "expo-brightness": "~11.4.0",
25
+ "expo-build-properties": "~0.8.2",
26
+ "expo-calendar": "~11.3.0",
27
+ "expo-camera": "~13.4.0",
28
+ "expo-cellular": "~5.3.0",
29
+ "expo-checkbox": "~2.4.0",
30
+ "expo-clipboard": "~4.3.0",
31
+ "expo-constants": "~14.4.2",
32
+ "expo-contacts": "~12.2.0",
33
+ "expo-crypto": "~12.4.0",
34
+ "expo-dev-client": "~2.4.1",
35
+ "expo-device": "~5.4.0",
36
+ "expo-document-picker": "~11.5.1",
37
+ "expo-face-detector": "~12.2.0",
38
+ "expo-file-system": "~15.4.1",
39
+ "expo-font": "~11.4.0",
40
+ "expo-gl": "~13.0.0",
41
41
  "expo-google-app-auth": "~8.3.0",
42
- "expo-haptics": "~12.2.1",
43
- "expo-image": "~1.0.1",
44
- "expo-image-loader": "~4.1.1",
45
- "expo-image-manipulator": "~11.1.1",
46
- "expo-image-picker": "~14.1.1",
47
- "expo-in-app-purchases": "~14.1.1",
48
- "expo-intent-launcher": "~10.5.2",
49
- "expo-keep-awake": "~12.0.1",
50
- "expo-linear-gradient": "~12.1.2",
51
- "expo-linking": "~4.0.1",
52
- "expo-local-authentication": "~13.3.0",
53
- "expo-localization": "~14.1.1",
54
- "expo-location": "~15.1.1",
55
- "expo-mail-composer": "~12.1.1",
56
- "expo-media-library": "~15.2.3",
57
- "expo-module-template": "~10.7.17",
58
- "expo-modules-core": "~1.2.7",
59
- "expo-navigation-bar": "~2.1.1",
60
- "expo-network": "~5.2.1",
61
- "expo-notifications": "~0.18.1",
62
- "expo-permissions": "~14.1.1",
63
- "expo-print": "~12.2.1",
64
- "expo-random": "~13.1.1",
65
- "expo-screen-capture": "~5.1.1",
66
- "expo-screen-orientation": "~5.1.1",
67
- "expo-secure-store": "~12.1.1",
68
- "expo-sensors": "~12.1.1",
69
- "expo-sharing": "~11.2.2",
70
- "expo-sms": "~11.2.1",
71
- "expo-speech": "~11.1.1",
72
- "expo-splash-screen": "~0.18.2",
73
- "expo-sqlite": "~11.1.1",
74
- "expo-status-bar": "~1.4.4",
75
- "expo-store-review": "~6.2.1",
76
- "expo-system-ui": "~2.2.1",
77
- "expo-task-manager": "~11.1.1",
78
- "expo-tracking-transparency": "~3.0.3",
79
- "expo-updates": "~0.16.4",
80
- "expo-video-thumbnails": "~7.2.1",
81
- "expo-web-browser": "~12.1.1",
82
- "lottie-react-native": "5.1.4",
42
+ "expo-haptics": "~12.4.0",
43
+ "expo-image": "~1.3.0",
44
+ "expo-image-loader": "~4.3.0",
45
+ "expo-image-manipulator": "~11.3.0",
46
+ "expo-image-picker": "~14.3.0",
47
+ "expo-in-app-purchases": "~14.3.0",
48
+ "expo-intent-launcher": "~10.7.0",
49
+ "expo-keep-awake": "~12.3.0",
50
+ "expo-linear-gradient": "~12.3.0",
51
+ "expo-linking": "~5.0.2",
52
+ "expo-local-authentication": "~13.4.1",
53
+ "expo-localization": "~14.3.0",
54
+ "expo-location": "~16.0.0",
55
+ "expo-mail-composer": "~12.3.0",
56
+ "expo-media-library": "~15.4.0",
57
+ "expo-module-template": "~10.9.2",
58
+ "expo-modules-core": "~1.5.3",
59
+ "expo-navigation-bar": "~2.3.0",
60
+ "expo-network": "~5.4.0",
61
+ "expo-notifications": "~0.20.1",
62
+ "expo-permissions": "~14.2.0",
63
+ "expo-print": "~12.4.1",
64
+ "expo-random": "~13.2.0",
65
+ "expo-router": "2.0.0-rc.6",
66
+ "expo-screen-capture": "~5.3.0",
67
+ "expo-screen-orientation": "~6.0.1",
68
+ "expo-secure-store": "~12.3.0",
69
+ "expo-sensors": "~12.3.0",
70
+ "expo-sharing": "~11.5.0",
71
+ "expo-sms": "~11.4.0",
72
+ "expo-speech": "~11.3.0",
73
+ "expo-splash-screen": "~0.20.1",
74
+ "expo-sqlite": "~11.3.0",
75
+ "expo-status-bar": "~1.6.0",
76
+ "expo-store-review": "~6.4.0",
77
+ "expo-system-ui": "~2.4.0",
78
+ "expo-task-manager": "~11.3.0",
79
+ "expo-tracking-transparency": "~3.1.0",
80
+ "expo-updates": "~0.18.4",
81
+ "expo-video-thumbnails": "~7.4.0",
82
+ "expo-web-browser": "~12.3.1",
83
+ "lottie-react-native": "5.1.6",
83
84
  "react": "18.2.0",
84
85
  "react-dom": "18.2.0",
85
- "react-native": "0.71.8",
86
+ "react-native": "0.72.0",
86
87
  "react-native-web": "~0.18.10",
87
88
  "react-native-branch": "^5.4.0",
88
- "react-native-gesture-handler": "~2.9.0",
89
+ "react-native-gesture-handler": "~2.12.0",
89
90
  "react-native-get-random-values": "~1.8.0",
90
- "react-native-maps": "1.3.2",
91
- "react-native-pager-view": "6.1.2",
92
- "react-native-reanimated": "~2.14.4",
93
- "react-native-screens": "~3.20.0",
94
- "react-native-safe-area-context": "4.5.0",
95
- "react-native-shared-element": "0.8.8",
96
- "react-native-svg": "13.4.0",
97
- "react-native-view-shot": "3.5.0",
98
- "react-native-webview": "11.26.0",
99
- "sentry-expo": "~6.1.0",
100
- "unimodules-app-loader": "~4.1.1",
91
+ "react-native-maps": "1.7.1",
92
+ "react-native-pager-view": "6.2.0",
93
+ "react-native-reanimated": "~3.3.0",
94
+ "react-native-screens": "~3.22.0",
95
+ "react-native-safe-area-context": "4.6.3",
96
+ "react-native-svg": "13.9.0",
97
+ "react-native-view-shot": "3.7.0",
98
+ "react-native-webview": "13.2.2",
99
+ "sentry-expo": "~7.0.0",
100
+ "unimodules-app-loader": "~4.2.0",
101
101
  "unimodules-image-loader-interface": "~6.1.0",
102
- "@shopify/react-native-skia": "0.1.172",
103
- "@shopify/flash-list": "1.4.0",
104
- "@sentry/react-native": "4.13.0"
102
+ "@shopify/react-native-skia": "0.1.195",
103
+ "@shopify/flash-list": "1.4.3",
104
+ "@sentry/react-native": "5.5.0"
105
105
  }
@@ -0,0 +1 @@
1
+ export * from '@expo/metro-config';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo",
3
- "version": "48.0.19",
3
+ "version": "49.0.0-alpha.10",
4
4
  "description": "The Expo SDK",
5
5
  "main": "build/Expo.js",
6
6
  "module": "build/Expo.js",
@@ -9,9 +9,7 @@
9
9
  "*.fx.js",
10
10
  "*.fx.web.js"
11
11
  ],
12
- "bin": {
13
- "expo": "bin/cli.js"
14
- },
12
+ "bin": "bin/cli",
15
13
  "files": [
16
14
  "android",
17
15
  "bin",
@@ -24,6 +22,7 @@
24
22
  "bundledNativeModules.json",
25
23
  "expo-module.config.json",
26
24
  "metro-config.js",
25
+ "metro-config.d.ts",
27
26
  "config.js",
28
27
  "config.d.ts",
29
28
  "config-plugins.js",
@@ -59,22 +58,20 @@
59
58
  "homepage": "https://github.com/expo/expo/tree/main/packages/expo",
60
59
  "dependencies": {
61
60
  "@babel/runtime": "^7.20.0",
62
- "@expo/cli": "0.7.3",
61
+ "@expo/cli": "0.10.3",
63
62
  "@expo/vector-icons": "^13.0.0",
64
- "@expo/config-plugins": "6.0.2",
65
- "@expo/config": "8.0.2",
66
- "babel-preset-expo": "~9.3.2",
67
- "cross-spawn": "^6.0.5",
68
- "expo-application": "~5.1.1",
69
- "expo-asset": "~8.9.1",
70
- "expo-constants": "~14.2.1",
71
- "expo-file-system": "~15.2.2",
72
- "expo-font": "~11.1.1",
73
- "expo-keep-awake": "~12.0.1",
74
- "expo-modules-autolinking": "1.2.0",
75
- "expo-modules-core": "1.2.7",
63
+ "@expo/config-plugins": "7.2.2",
64
+ "@expo/config": "8.1.1",
65
+ "babel-preset-expo": "~9.5.0",
66
+ "expo-application": "~5.3.0",
67
+ "expo-asset": "~8.10.1",
68
+ "expo-constants": "~14.4.2",
69
+ "expo-file-system": "~15.4.1",
70
+ "expo-font": "~11.4.0",
71
+ "expo-keep-awake": "~12.3.0",
72
+ "expo-modules-autolinking": "1.5.0",
73
+ "expo-modules-core": "1.5.3",
76
74
  "fbemitter": "^3.0.0",
77
- "getenv": "^1.0.0",
78
75
  "invariant": "^2.2.4",
79
76
  "md5-file": "^3.2.3",
80
77
  "node-fetch": "^2.6.7",
@@ -87,10 +84,10 @@
87
84
  "@types/react": "~18.0.14",
88
85
  "@types/react-test-renderer": "^18.0.0",
89
86
  "@types/uuid": "^3.4.7",
90
- "expo-module-scripts": "^3.0.7",
87
+ "expo-module-scripts": "^3.0.10",
91
88
  "react": "18.2.0",
92
89
  "react-dom": "18.2.0",
93
- "react-native": "0.71.8"
90
+ "react-native": "0.72.0"
94
91
  },
95
- "gitHead": "e4d7252e19400e1ff6653827c143728d75f6c8ec"
92
+ "gitHead": "aa6bda733cef821234c77a19bbe6008b72c1c594"
96
93
  }
@@ -1,12 +1,56 @@
1
+ const findProjectRoot = require('@react-native-community/cli-tools').findProjectRoot;
2
+ const fs = require('fs');
1
3
  const path = require('path');
2
4
 
5
+ const projectRoot = findProjectRoot();
6
+
7
+ function isMatchedInFile(filePath, regexp) {
8
+ const contents = fs.readFileSync(filePath, 'utf8');
9
+ return !!contents.match(regexp);
10
+ }
11
+
12
+ /**
13
+ * Checks if expo-modules-autolinking is setup on iOS
14
+ */
15
+ function isExpoModulesInstalledIos(projectRoot) {
16
+ const podfilePath = path.join(projectRoot, 'ios', 'Podfile');
17
+ if (!fs.existsSync(podfilePath)) {
18
+ // Assumes true for managed apps
19
+ return true;
20
+ }
21
+ return isMatchedInFile(
22
+ podfilePath,
23
+ /^\s*require File.join\(File\.dirname\(`node --print "require\.resolve\('expo\/package\.json'\)"`\), "scripts\/autolinking"\)\s*$/m
24
+ );
25
+ }
26
+
27
+ /**
28
+ * Checks if expo-modules-autolinking is setup on Android
29
+ */
30
+ function isExpoModulesInstalledAndroid(projectRoot) {
31
+ const gradlePath = path.join(projectRoot, 'android', 'settings.gradle');
32
+ if (!fs.existsSync(gradlePath)) {
33
+ // Assumes true for managed apps
34
+ return true;
35
+ }
36
+ return isMatchedInFile(
37
+ gradlePath,
38
+ /^\s*apply from: (new File|file)\(\["node", "--print", "require\.resolve\('expo\/package.json'\)"\]\.execute\(null, rootDir\)\.text\.trim\(\), "\.\.\/scripts\/autolinking\.gradle"\);?\s*$/m
39
+ );
40
+ }
41
+
3
42
  module.exports = {
4
43
  dependency: {
5
44
  platforms: {
6
- ios: {},
7
- android: {
8
- packageImportPath: 'import expo.modules.ExpoModulesPackage;',
9
- },
45
+ // To make Expo CLI works on bare react-native projects without installing Expo Modules, we disable autolinking in this case.
46
+ ios: !isExpoModulesInstalledIos(projectRoot) ? null : {},
47
+ android: !isExpoModulesInstalledAndroid(projectRoot)
48
+ ? null
49
+ : {
50
+ packageImportPath: 'import expo.modules.ExpoModulesPackage;',
51
+ },
52
+ macos: null,
53
+ windows: null,
10
54
  },
11
55
  },
12
56
  };
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Copyright © 2023 650 Industries.
4
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ *
9
+ * Forked as-is from React Native.
10
+ * @format
11
+ */
12
+
13
+ 'use strict';
14
+
15
+ const { composeSourceMaps } = require('metro-source-map');
16
+ const fs = require('fs');
17
+
18
+ const argv = process.argv.slice(2);
19
+ let outputPath;
20
+ for (let i = 0; i < argv.length; ) {
21
+ if (argv[i] === '-o') {
22
+ outputPath = argv[i + 1];
23
+ argv.splice(i, 2);
24
+ continue;
25
+ }
26
+ ++i;
27
+ }
28
+ if (!argv.length) {
29
+ process.stderr.write(
30
+ 'Usage: node compose-source-maps.js <packager_sourcemap> <compiler_sourcemap> [-o output_file]\n'
31
+ );
32
+ process.exitCode = -1;
33
+ } else {
34
+ const [packagerSourcemapPath, compilerSourcemapPath] = argv.splice(0, 2);
35
+ const packagerSourcemap = JSON.parse(fs.readFileSync(packagerSourcemapPath, 'utf8'));
36
+ const compilerSourcemap = JSON.parse(fs.readFileSync(compilerSourcemapPath, 'utf8'));
37
+
38
+ if (
39
+ packagerSourcemap.x_facebook_offsets != null ||
40
+ compilerSourcemap.x_facebook_offsets != null
41
+ ) {
42
+ throw new Error(
43
+ 'Random Access Bundle (RAM) format is not supported by this tool; ' +
44
+ 'it cannot process the `x_facebook_offsets` field provided ' +
45
+ 'in the base and/or target source map(s)'
46
+ );
47
+ }
48
+
49
+ if (compilerSourcemap.x_facebook_segments != null) {
50
+ throw new Error(
51
+ 'This tool cannot process the `x_facebook_segments` field provided ' +
52
+ 'in the target source map.'
53
+ );
54
+ }
55
+
56
+ const composedMapJSON = JSON.stringify(composeSourceMaps([packagerSourcemap, compilerSourcemap]));
57
+ if (outputPath) {
58
+ fs.writeFileSync(outputPath, composedMapJSON, 'utf8');
59
+ } else {
60
+ process.stdout.write();
61
+ }
62
+ }
@@ -0,0 +1,43 @@
1
+ #!/bin/bash
2
+ # Copyright © 2023 650 Industries.
3
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ #
5
+ # This source code is licensed under the MIT license found in the
6
+ # LICENSE file in the root directory of this source tree.
7
+
8
+ # Set terminal title
9
+ echo -en "\\033]0;npx expo\\a"
10
+ clear
11
+
12
+ THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
13
+
14
+ export PODS_ROOT="$THIS_DIR/../../../ios/Pods"
15
+
16
+
17
+ WITH_ENVIRONMENT="$THIS_DIR/xcode/with-environment.sh"
18
+ source $WITH_ENVIRONMENT
19
+
20
+ # if [ -z "$NODE_BINARY" ]; then
21
+ # NODE_BINARY=$(command -v node)
22
+ # fi
23
+ # WITH_ENVIRONMENT="$("$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json', { paths: [process.cwd()] })) + '/scripts/with-environment.sh'")"
24
+ # echo $WITH_ENVIRONMENT
25
+
26
+ # export packager environment variables
27
+ #source "$THIS_DIR/.packager.env"
28
+
29
+ # if [ -n "${RCT_PACKAGER_LOGS_DIR}" ] ; then
30
+ # echo "Writing logs to $RCT_PACKAGER_LOGS_DIR"
31
+ # # shellcheck source=/dev/null
32
+ # RCT_PACKAGER_LOG_PATH="$RCT_PACKAGER_LOGS_DIR/metro.log" \
33
+ # . "$THIS_DIR/packager.sh" \
34
+ # > "$RCT_PACKAGER_LOGS_DIR/packager.stdout.log" \
35
+ # 2> "$RCT_PACKAGER_LOGS_DIR/packager.stderr.log"
36
+ # else
37
+ # shellcheck source=/dev/null
38
+ . "$THIS_DIR/packager.sh"
39
+ # fi
40
+ # if [[ -z "$CI" ]]; then
41
+ # echo "Process terminated. Press <enter> to close the window"
42
+ # read -r
43
+ # fi
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+ # Copyright © 2023 650 Industries.
3
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ #
5
+ # This source code is licensed under the MIT license found in the
6
+ # LICENSE file in the root directory of this source tree.
7
+
8
+ [ -z "$NODE_BINARY" ] && export NODE_BINARY="node"
9
+
10
+ nodejs_not_found()
11
+ {
12
+ echo "error: Can't find the '$NODE_BINARY' binary to build the React Native bundle. " \
13
+ "If you have a non-standard Node.js installation, select your project in Xcode, find " \
14
+ "'Build Phases' - 'Bundle React Native code and images' and change NODE_BINARY to an " \
15
+ "absolute path to your node executable. You can find it by invoking 'which node' in the terminal." >&2
16
+ exit 2
17
+ }
18
+
19
+ type "$NODE_BINARY" >/dev/null 2>&1 || nodejs_not_found
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+ # Copyright © 2023 650 Industries.
3
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ #
5
+ # This source code is licensed under the MIT license found in the
6
+ # LICENSE file in the root directory of this source tree.
7
+
8
+ # NOTE(EvanBacon): This is a fork of the react-native packager.sh script but with the ability
9
+ # to use Expo CLI to start the packager. This ensures the `@expo/metro-config`` is always used.
10
+
11
+ # TODO: Replace all manual fs checks with Node.js module resolution.
12
+
13
+ # scripts directory
14
+ THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
15
+ EXPO_PKG_ROOT="$THIS_DIR/.."
16
+ # Application root directory - General use case: react-native is a dependency
17
+ PROJECT_ROOT="$THIS_DIR/../../.."
18
+
19
+ # check and assign NODE_BINARY env
20
+ # shellcheck disable=SC1090
21
+ source "${THIS_DIR}/node-binary.sh"
22
+
23
+ # When running react-native tests, react-native doesn't live in node_modules but in the PROJECT_ROOT
24
+ if [ ! -d "$PROJECT_ROOT/node_modules/expo" ];
25
+ then
26
+ PROJECT_ROOT="$THIS_DIR/.."
27
+ fi
28
+
29
+ # Start packager from PROJECT_ROOT
30
+ cd "$PROJECT_ROOT" || exit
31
+ "$NODE_BINARY" "$EXPO_PKG_ROOT/../@expo/cli/build/bin/cli" start --dev-client "$@"
@@ -0,0 +1,194 @@
1
+ #!/bin/bash
2
+ # Copyright © 2023 650 Industries.
3
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ #
5
+ # This source code is licensed under the MIT license found in the
6
+ # LICENSE file in the root directory of this source tree.
7
+
8
+ # Bundle React Native app's code and image assets.
9
+ # This script is supposed to be invoked as part of Xcode build process
10
+ # and relies on environment variables (including PWD) set by Xcode
11
+
12
+ # Print commands before executing them (useful for troubleshooting)
13
+ set -x
14
+ DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH
15
+
16
+ # Enables iOS devices to get the IP address of the machine running Metro
17
+ if [[ ! "$SKIP_BUNDLING_METRO_IP" && "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then
18
+ for num in 0 1 2 3 4 5 6 7 8; do
19
+ IP=$(ipconfig getifaddr en${num})
20
+ if [ ! -z "$IP" ]; then
21
+ break
22
+ fi
23
+ done
24
+ if [ -z "$IP" ]; then
25
+ IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | grep -v ' 169.254.' |cut -d\ -f2 | awk 'NR==1{print $1}')
26
+ fi
27
+
28
+ echo "$IP" > "$DEST/ip.txt"
29
+ fi
30
+
31
+ if [[ "$SKIP_BUNDLING" ]]; then
32
+ echo "SKIP_BUNDLING enabled; skipping."
33
+ exit 0;
34
+ fi
35
+
36
+ case "$CONFIGURATION" in
37
+ *Debug*)
38
+ if [[ "$PLATFORM_NAME" == *simulator ]]; then
39
+ if [[ "$FORCE_BUNDLING" ]]; then
40
+ echo "FORCE_BUNDLING enabled; continuing to bundle."
41
+ else
42
+ echo "Skipping bundling in Debug for the Simulator (since the packager bundles for you). Use the FORCE_BUNDLING flag to change this behavior."
43
+ exit 0;
44
+ fi
45
+ else
46
+ echo "Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior."
47
+ fi
48
+
49
+ DEV=true
50
+ ;;
51
+ "")
52
+ echo "$0 must be invoked by Xcode"
53
+ exit 1
54
+ ;;
55
+ *)
56
+ DEV=false
57
+ ;;
58
+ esac
59
+
60
+ # Path to react-native folder inside node_modules
61
+ REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
62
+ # The project should be located next to where react-native is installed
63
+ # in node_modules.
64
+ PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../.."}
65
+
66
+ cd "$PROJECT_ROOT" || exit
67
+
68
+ # Define entry file
69
+ if [[ "$ENTRY_FILE" ]]; then
70
+ # Use ENTRY_FILE defined by user
71
+ :
72
+ elif [[ -s "index.ios.js" ]]; then
73
+ ENTRY_FILE=${1:-index.ios.js}
74
+ else
75
+ ENTRY_FILE=${1:-index.js}
76
+ fi
77
+
78
+ # check and assign NODE_BINARY env
79
+ # shellcheck source=/dev/null
80
+ source "$REACT_NATIVE_DIR/scripts/node-binary.sh"
81
+
82
+ # If hermes-engine is in the Podfile.lock, it means that Hermes is a dependency of the project
83
+ # and it is enabled. If not, it means that hermes is disabled.
84
+ HERMES_ENABLED=$(grep hermes-engine $PODS_PODFILE_DIR_PATH/Podfile.lock)
85
+
86
+ # If hermes-engine is not in the Podfile.lock, it means that the app is not using Hermes.
87
+ # Setting USE_HERMES is no the only way to set whether the app can use hermes or not: users
88
+ # can also modify manually the Podfile.
89
+ if [[ -z "$HERMES_ENABLED" ]]; then
90
+ USE_HERMES=false
91
+ fi
92
+
93
+ HERMES_ENGINE_PATH="$PODS_ROOT/hermes-engine"
94
+ [ -z "$HERMES_CLI_PATH" ] && HERMES_CLI_PATH="$HERMES_ENGINE_PATH/destroot/bin/hermesc"
95
+
96
+ # Hermes is enabled in new projects by default, so we cannot assume that USE_HERMES=1 is set as an envvar.
97
+ # If hermes-engine is found in Pods, we can assume Hermes has not been disabled.
98
+ # If hermesc is not available and USE_HERMES is either unset or true, show error.
99
+ if [[ ! -z "$HERMES_ENABLED" && -f "$HERMES_ENGINE_PATH" && ! -f "$HERMES_CLI_PATH" ]]; then
100
+ echo "error: Hermes is enabled but the hermesc binary could not be found at ${HERMES_CLI_PATH}." \
101
+ "Perhaps you need to run 'bundle exec pod install' or otherwise " \
102
+ "point the HERMES_CLI_PATH variable to your custom location." >&2
103
+ exit 2
104
+ fi
105
+
106
+ [ -z "$NODE_ARGS" ] && export NODE_ARGS=""
107
+
108
+ [ -z "$CLI_PATH" ] && export CLI_PATH="$REACT_NATIVE_DIR/bin/cli.js"
109
+
110
+ [ -z "$BUNDLE_COMMAND" ] && BUNDLE_COMMAND="bundle:local"
111
+
112
+ [ -z "$COMPOSE_SOURCEMAP_PATH" ] && COMPOSE_SOURCEMAP_PATH="$REACT_NATIVE_DIR/scripts/compose-source-maps.js"
113
+
114
+ if [[ -z "$BUNDLE_CONFIG" ]]; then
115
+ CONFIG_ARG=""
116
+ else
117
+ CONFIG_ARG="--config $BUNDLE_CONFIG"
118
+ fi
119
+
120
+ BUNDLE_FILE="$CONFIGURATION_BUILD_DIR/main.jsbundle"
121
+
122
+ EXTRA_ARGS=
123
+
124
+ case "$PLATFORM_NAME" in
125
+ "macosx")
126
+ BUNDLE_PLATFORM="macos"
127
+ ;;
128
+ *)
129
+ BUNDLE_PLATFORM="ios"
130
+ ;;
131
+ esac
132
+
133
+ if [ "${IS_MACCATALYST}" = "YES" ]; then
134
+ BUNDLE_PLATFORM="ios"
135
+ fi
136
+
137
+ EMIT_SOURCEMAP=
138
+ if [[ ! -z "$SOURCEMAP_FILE" ]]; then
139
+ EMIT_SOURCEMAP=true
140
+ fi
141
+
142
+ PACKAGER_SOURCEMAP_FILE=
143
+ if [[ $EMIT_SOURCEMAP == true ]]; then
144
+ if [[ $USE_HERMES != false ]]; then
145
+ PACKAGER_SOURCEMAP_FILE="$CONFIGURATION_BUILD_DIR/$(basename $SOURCEMAP_FILE)"
146
+ else
147
+ PACKAGER_SOURCEMAP_FILE="$SOURCEMAP_FILE"
148
+ fi
149
+ EXTRA_ARGS="$EXTRA_ARGS --sourcemap-output $PACKAGER_SOURCEMAP_FILE"
150
+ fi
151
+
152
+ # Hermes doesn't require JS minification.
153
+ if [[ $USE_HERMES != false && $DEV == false ]]; then
154
+ EXTRA_ARGS="$EXTRA_ARGS --minify false"
155
+ fi
156
+
157
+ "$NODE_BINARY" $NODE_ARGS "$CLI_PATH" $BUNDLE_COMMAND \
158
+ $CONFIG_ARG \
159
+ --entry-file "$ENTRY_FILE" \
160
+ --platform "$BUNDLE_PLATFORM" \
161
+ --dev $DEV \
162
+ --reset-cache \
163
+ --bundle-output "$BUNDLE_FILE" \
164
+ --assets-dest "$DEST" \
165
+ $EXTRA_ARGS \
166
+ $EXTRA_PACKAGER_ARGS
167
+
168
+ if [[ $USE_HERMES == false ]]; then
169
+ cp "$BUNDLE_FILE" "$DEST/"
170
+ BUNDLE_FILE="$DEST/main.jsbundle"
171
+ else
172
+ EXTRA_COMPILER_ARGS=
173
+ if [[ $DEV == true ]]; then
174
+ EXTRA_COMPILER_ARGS=-Og
175
+ else
176
+ EXTRA_COMPILER_ARGS=-O
177
+ fi
178
+ if [[ $EMIT_SOURCEMAP == true ]]; then
179
+ EXTRA_COMPILER_ARGS="$EXTRA_COMPILER_ARGS -output-source-map"
180
+ fi
181
+ "$HERMES_CLI_PATH" -emit-binary $EXTRA_COMPILER_ARGS -out "$DEST/main.jsbundle" "$BUNDLE_FILE"
182
+ if [[ $EMIT_SOURCEMAP == true ]]; then
183
+ HBC_SOURCEMAP_FILE="$DEST/main.jsbundle.map"
184
+ "$NODE_BINARY" "$COMPOSE_SOURCEMAP_PATH" "$PACKAGER_SOURCEMAP_FILE" "$HBC_SOURCEMAP_FILE" -o "$SOURCEMAP_FILE"
185
+ rm "$HBC_SOURCEMAP_FILE"
186
+ rm "$PACKAGER_SOURCEMAP_FILE"
187
+ fi
188
+ BUNDLE_FILE="$DEST/main.jsbundle"
189
+ fi
190
+
191
+ if [[ $DEV != true && ! -f "$BUNDLE_FILE" ]]; then
192
+ echo "error: File $BUNDLE_FILE does not exist. This must be a bug with the xcode template, report it here: https://github.com/expo/expo/issues" >&2
193
+ exit 2
194
+ fi
File without changes
@@ -0,0 +1,47 @@
1
+ #!/bin/bash
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ #
4
+ # This source code is licensed under the MIT license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ # This script is used to source in Xcode the environment settings required to run properly.
8
+ # The script first sources the base `.xcode.env` file.
9
+ # Then it sources the `.xcode.env.local` file if present, to override some local config
10
+ # Finally, it will execute the command passed i input if any.
11
+ #
12
+ # USAGE:
13
+ # ./with-environment.sh command
14
+
15
+ # Start with a default
16
+ NODE_BINARY=$(command -v node)
17
+ export NODE_BINARY
18
+
19
+ # Override the default with the global environment
20
+ ENV_PATH="$PODS_ROOT/../.xcode.env"
21
+ if [ -f "$ENV_PATH" ]; then
22
+ source "$ENV_PATH"
23
+ fi
24
+
25
+ # Override the global with the local environment
26
+ LOCAL_ENV_PATH="${ENV_PATH}.local"
27
+ if [ -f "$LOCAL_ENV_PATH" ]; then
28
+ source "$LOCAL_ENV_PATH"
29
+ fi
30
+
31
+ # Check whether NODE_BINARY has been properly set, otherwise help the users with a meaningful error.
32
+ if [ -n "$NODE_BINARY" ]; then
33
+ echo "Node found at: ${NODE_BINARY}"
34
+ else
35
+ echo '[Warning] You need to configure your node path in the `".xcode.env" file` environment. ' \
36
+ 'You can set it up quickly by running: ' \
37
+ '`echo export NODE_BINARY=$(command -v node) > .xcode.env` ' \
38
+ 'in the ios folder. This is needed by React Native to work correctly. ' \
39
+ 'We fallback to the DEPRECATED behavior of finding `node`. This will be REMOVED in a future version. ' \
40
+ 'You can read more about this here: https://reactnative.dev/docs/environment-setup#optional-configuring-your-environment' >&2
41
+ source "${REACT_NATIVE_PATH}/scripts/find-node-for-xcode.sh"
42
+ fi
43
+
44
+ # Execute argument, if present
45
+ if [ -n "$1" ]; then
46
+ $1
47
+ fi
package/bin/cli.js DELETED
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
- const spawn = require('cross-spawn').spawn;
4
- const { boolish } = require('getenv');
5
-
6
- run();
7
-
8
- function run() {
9
- // Use new local CLI by default.
10
- if (boolish('EXPO_USE_LOCAL_CLI', true)) {
11
- return spawn(require.resolve('@expo/cli'), process.argv.slice(2), { stdio: 'inherit' }).on(
12
- 'exit',
13
- (code) => {
14
- process.exit(code);
15
- }
16
- );
17
- }
18
-
19
- spawn('expo-cli', process.argv.slice(2), { stdio: 'inherit' })
20
- .on('exit', function (code) {
21
- process.exit(code);
22
- })
23
- .on('error', function () {
24
- console.warn('This command requires Expo CLI.');
25
- const rl = require('readline').createInterface({
26
- input: process.stdin,
27
- output: process.stdout,
28
- });
29
- rl.question('Do you want to install it globally [Y/n]? ', function (answer) {
30
- rl.close();
31
- if (/^n/i.test(answer.trim())) {
32
- process.exit(1);
33
- } else {
34
- console.log("Installing the package 'expo-cli'...");
35
- spawn('npm', ['install', '--global', '--loglevel', 'error', 'expo-cli'], {
36
- stdio: ['inherit', 'ignore', 'inherit'],
37
- }).on('close', function (code) {
38
- if (code !== 0) {
39
- console.error('Installing Expo CLI failed. You can install it manually with:');
40
- console.error(' npm install --global expo-cli');
41
- process.exit(code);
42
- } else {
43
- console.log('Expo CLI installed. You can run `expo --help` for instructions.');
44
- run();
45
- }
46
- });
47
- }
48
- });
49
- });
50
- }