expo 52.0.0-preview.17 → 52.0.0-preview.19

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/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # expo
2
2
 
3
- The `expo` package is a single package you can install in any React Native app to begin using Expo modules.
3
+ The `expo` package is a single package you can install in any React Native app to begin using Expo modules. [API Reference](https://docs.expo.dev/versions/latest/sdk/expo/).
4
4
 
5
5
  - includes core infrastructure for Expo modules: `expo-modules-core` and `expo-modules-autolinking`.
6
6
  - bundles a minimal set of Expo modules that are required by nearly every app, such as `expo-asset`.
7
7
  - provides [`@expo/cli`](https://github.com/expo/expo/blob/main/packages/%40expo/cli/README.md), a small CLI that provides a clean interface around both bundlers (such as Metro and Webpack) and native build tools (Xcode, Simulator.app, Android Studio, ADB, etc.), can generate native projects with `npx expo prebuild`, and aligns compatible package versions with `npx expo install`.
8
8
  - exposes a JavaScript module that configures an app at runtime as needed to use `expo-font` and to function in Expo Go (optional, only if applicable).
9
9
 
10
+
10
11
  See [CONTRIBUTING](./CONTRIBUTING.md) for instructions on working on this package.
@@ -33,7 +33,7 @@ def getRNVersion() {
33
33
  ensureDependeciesWereEvaluated(project)
34
34
 
35
35
  group = 'host.exp.exponent'
36
- version = '52.0.0-preview.17'
36
+ version = '52.0.0-preview.19'
37
37
 
38
38
  buildscript {
39
39
  // Simple helper that allows the root project to override versions declared by this library.
@@ -46,7 +46,7 @@ android {
46
46
  namespace "expo.core"
47
47
  defaultConfig {
48
48
  versionCode 1
49
- versionName "52.0.0-preview.17"
49
+ versionName "52.0.0-preview.19"
50
50
  consumerProguardFiles("proguard-rules.pro")
51
51
  }
52
52
  testOptions {
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Get the base URL for the DOM Components HTML
3
+ */
4
+ export declare function getBaseURL(): string;
5
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/dom/base.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CA6CnC"}
@@ -2,9 +2,7 @@ import React from 'react';
2
2
  import type { DOMProps } from './dom.types';
3
3
  interface Props {
4
4
  dom: DOMProps;
5
- source: {
6
- uri: string;
7
- };
5
+ filePath: string;
8
6
  }
9
7
  declare const RawWebView: React.ForwardRefExoticComponent<Props & React.RefAttributes<object>>;
10
8
  export declare function resolveWebView(useExpoDOMWebView: boolean): any;
@@ -1 +1 @@
1
- {"version":3,"file":"webview-wrapper.d.ts","sourceRoot":"","sources":["../../src/dom/webview-wrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAiB,QAAQ,EAA4B,MAAM,aAAa,CAAC;AAcrF,UAAU,KAAK;IACb,GAAG,EAAE,QAAQ,CAAC;IACd,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,QAAA,MAAM,UAAU,sEA6Kd,CAAC;AAaH,wBAAgB,cAAc,CAAC,iBAAiB,EAAE,OAAO,OASxD;AAED,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"webview-wrapper.d.ts","sourceRoot":"","sources":["../../src/dom/webview-wrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAiB,QAAQ,EAA4B,MAAM,aAAa,CAAC;AAcrF,UAAU,KAAK;IACb,GAAG,EAAE,QAAQ,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,UAAU,sEA8Kd,CAAC;AAaH,wBAAgB,cAAc,CAAC,iBAAiB,EAAE,OAAO,OASxD;AAED,eAAe,UAAU,CAAC"}
@@ -1,5 +1,5 @@
1
1
  {
2
- "@expo/metro-runtime": "~4.0.0-preview.0",
2
+ "@expo/metro-runtime": "~4.0.0-preview.1",
3
3
  "@expo/vector-icons": "^14.0.2",
4
4
  "@react-native-async-storage/async-storage": "1.23.1",
5
5
  "@react-native-community/datetimepicker": "8.2.0",
@@ -45,7 +45,7 @@
45
45
  "expo-image": "~2.0.0-preview.1",
46
46
  "expo-image-loader": "~5.0.0",
47
47
  "expo-image-manipulator": "~13.0.5",
48
- "expo-image-picker": "~16.0.0",
48
+ "expo-image-picker": "~16.0.1",
49
49
  "expo-intent-launcher": "~12.0.1",
50
50
  "expo-insights": "~0.8.1",
51
51
  "expo-keep-awake": "~14.0.1",
@@ -55,14 +55,14 @@
55
55
  "expo-localization": "~16.0.0",
56
56
  "expo-location": "~18.0.1",
57
57
  "expo-mail-composer": "~14.0.1",
58
- "expo-media-library": "~17.0.0",
59
- "expo-module-template": "~10.15.5",
58
+ "expo-media-library": "~17.0.1",
59
+ "expo-module-template": "~10.15.6",
60
60
  "expo-modules-core": "~2.0.0-preview.9",
61
61
  "expo-navigation-bar": "~4.0.2",
62
62
  "expo-network": "~7.0.0",
63
63
  "expo-notifications": "~0.29.4",
64
64
  "expo-print": "~14.0.2",
65
- "expo-router": "~4.0.0-preview.11",
65
+ "expo-router": "~4.0.0-preview.12",
66
66
  "expo-screen-capture": "~7.0.0",
67
67
  "expo-screen-orientation": "~8.0.0",
68
68
  "expo-secure-store": "~14.0.0",
@@ -78,7 +78,7 @@
78
78
  "expo-system-ui": "~4.0.2",
79
79
  "expo-task-manager": "~12.0.1",
80
80
  "expo-tracking-transparency": "~5.0.0",
81
- "expo-updates": "~0.26.3",
81
+ "expo-updates": "~0.26.4",
82
82
  "expo-video-thumbnails": "~9.0.0",
83
83
  "expo-video": "~2.0.0-preview.0",
84
84
  "expo-web-browser": "~14.0.0",
@@ -0,0 +1 @@
1
+ export * from '@expo/fingerprint';
package/fingerprint.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('@expo/fingerprint');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo",
3
- "version": "52.0.0-preview.17",
3
+ "version": "52.0.0-preview.19",
4
4
  "description": "The Expo SDK",
5
5
  "main": "src/Expo.ts",
6
6
  "module": "src/Expo.ts",
@@ -33,6 +33,8 @@
33
33
  "devtools.d.ts",
34
34
  "fetch.js",
35
35
  "fetch.d.ts",
36
+ "fingerprint.js",
37
+ "fingerprint.d.ts",
36
38
  "react-native.config.js",
37
39
  "requiresExtraSetup.json",
38
40
  "tsconfig.base.json",
@@ -66,17 +68,18 @@
66
68
  "homepage": "https://github.com/expo/expo/tree/main/packages/expo",
67
69
  "dependencies": {
68
70
  "@babel/runtime": "^7.20.0",
69
- "@expo/cli": "0.19.12",
71
+ "@expo/cli": "0.19.14",
70
72
  "@expo/config": "10.0.2",
71
- "@expo/config-plugins": "9.0.4",
72
- "@expo/metro-config": "0.19.0-preview.2",
73
+ "@expo/config-plugins": "9.0.5",
74
+ "@expo/fingerprint": "0.11.2",
75
+ "@expo/metro-config": "0.19.0-preview.3",
73
76
  "@expo/vector-icons": "^14.0.0",
74
- "babel-preset-expo": "~12.0.0-preview.4",
77
+ "babel-preset-expo": "~12.0.0-preview.5",
75
78
  "expo-asset": "~11.0.0",
76
79
  "expo-file-system": "~18.0.0",
77
80
  "expo-font": "~13.0.0",
78
81
  "expo-keep-awake": "~14.0.1",
79
- "expo-modules-autolinking": "2.0.0-preview.2",
82
+ "expo-modules-autolinking": "2.0.0-preview.3",
80
83
  "expo-modules-core": "2.0.0-preview.9",
81
84
  "fbemitter": "^3.0.0",
82
85
  "web-streams-polyfill": "^3.3.2",
@@ -108,5 +111,5 @@
108
111
  "optional": true
109
112
  }
110
113
  },
111
- "gitHead": "5e5addd27a0530728670e63426794c2b6d937f49"
114
+ "gitHead": "d97ae0839fa465cee14e13ca38f3c6c84c124d82"
112
115
  }
@@ -0,0 +1,102 @@
1
+ jest.mock('react-native/Libraries/Core/Devtools/getDevServer', () =>
2
+ jest.fn().mockReturnValue({ url: 'http://localhost:8081' })
3
+ );
4
+
5
+ describe('getBaseURL', () => {
6
+ let getBaseURL;
7
+
8
+ const originalProcessEnv = process.env;
9
+ const originalExpo = globalThis.expo;
10
+ beforeEach(() => {
11
+ // Reset the module to clear the `getBaseURL` underlying cache
12
+ jest.resetModules();
13
+ getBaseURL = require('../base').getBaseURL;
14
+ });
15
+
16
+ afterEach(() => {
17
+ globalThis.expo = originalExpo;
18
+ process.env = originalProcessEnv;
19
+ });
20
+
21
+ it('should serve from updates directory when using updates', () => {
22
+ // @ts-expect-error: mock partial properties
23
+ globalThis.expo = {
24
+ modules: {
25
+ ExpoUpdates: {
26
+ isEnabled: true,
27
+ isEmbeddedLaunch: false,
28
+ localAssets: {
29
+ '5d41402abc4b2a76b9719d911017c592':
30
+ 'file:///path/to/.expo-internal/5d41402abc4b2a76b9719d911017c592.png',
31
+ },
32
+ },
33
+ },
34
+ };
35
+
36
+ expect(getBaseURL()).toBe('file:///path/to/.expo-internal');
37
+ });
38
+
39
+ it('should serve from app builtin directory when using updates with embedded bundle', () => {
40
+ // @ts-expect-error: mock partial properties
41
+ globalThis.expo = {
42
+ modules: {
43
+ ExpoUpdates: {
44
+ isEnabled: true,
45
+ isEmbeddedLaunch: true,
46
+ localAssets: {
47
+ '5d41402abc4b2a76b9719d911017c592':
48
+ 'file:///path/to/.expo-internal/5d41402abc4b2a76b9719d911017c592.png',
49
+ },
50
+ },
51
+ },
52
+ };
53
+ process.env.NODE_ENV = 'production';
54
+ switch (process.env.EXPO_OS) {
55
+ case 'android': {
56
+ expect(getBaseURL()).toBe('file:///android_asset/www.bundle');
57
+ break;
58
+ }
59
+ case 'ios': {
60
+ expect(getBaseURL()).toBe('www.bundle');
61
+ break;
62
+ }
63
+ default: {
64
+ expect(getBaseURL()).toBe('');
65
+ break;
66
+ }
67
+ }
68
+ });
69
+
70
+ it('should serve from app builtin directory for production builds', () => {
71
+ process.env.NODE_ENV = 'production';
72
+ switch (process.env.EXPO_OS) {
73
+ case 'android': {
74
+ expect(getBaseURL()).toBe('file:///android_asset/www.bundle');
75
+ break;
76
+ }
77
+ case 'ios': {
78
+ expect(getBaseURL()).toBe('www.bundle');
79
+ break;
80
+ }
81
+ default: {
82
+ expect(getBaseURL()).toBe('');
83
+ break;
84
+ }
85
+ }
86
+ });
87
+
88
+ it('should serve from dev server for development builds', () => {
89
+ process.env.NODE_ENV = 'development';
90
+ switch (process.env.EXPO_OS) {
91
+ case 'android':
92
+ case 'ios': {
93
+ expect(getBaseURL()).toBe('http://localhost:8081/_expo/@dom');
94
+ break;
95
+ }
96
+ default: {
97
+ expect(getBaseURL()).toBe('');
98
+ break;
99
+ }
100
+ }
101
+ });
102
+ });
@@ -0,0 +1,51 @@
1
+ let cachedBaseUrl: string | null = null;
2
+
3
+ /**
4
+ * Get the base URL for the DOM Components HTML
5
+ */
6
+ export function getBaseURL(): string {
7
+ if (cachedBaseUrl != null) {
8
+ return cachedBaseUrl;
9
+ }
10
+
11
+ // Serving from updates
12
+ const ExpoUpdates = globalThis.expo?.modules?.['ExpoUpdates'] as
13
+ | import('expo-updates').ExpoUpdatesModule
14
+ | undefined;
15
+ const updatesIsInstalledAndEnabled = ExpoUpdates?.isEnabled ?? false;
16
+ const updatesIsEmbeddedLaunch = ExpoUpdates?.isEmbeddedLaunch ?? false;
17
+ const shouldServeDomFromUpdates = updatesIsInstalledAndEnabled && !updatesIsEmbeddedLaunch;
18
+ // If updates is installed and enabled, and we're not running from an embedded launch, we should serve the DOM Components from the `.expo-internal` directory
19
+ if (shouldServeDomFromUpdates) {
20
+ const localAssets = ExpoUpdates?.localAssets ?? {};
21
+ const anyLocalAsset = Object.values(localAssets)[0];
22
+ if (anyLocalAsset) {
23
+ // Try to get the `.expo-internal` directory from the first local asset
24
+ cachedBaseUrl = anyLocalAsset.slice(0, anyLocalAsset.lastIndexOf('/'));
25
+ return cachedBaseUrl;
26
+ }
27
+ }
28
+
29
+ if (process.env.EXPO_OS === 'web') {
30
+ cachedBaseUrl = process.env.EXPO_BASE_URL ?? '';
31
+ return cachedBaseUrl;
32
+ }
33
+
34
+ // Serving from local production
35
+ if (process.env.NODE_ENV === 'production') {
36
+ if (process.env.EXPO_OS === 'android') {
37
+ cachedBaseUrl = 'file:///android_asset/www.bundle';
38
+ } else if (process.env.EXPO_OS === 'ios') {
39
+ cachedBaseUrl = 'www.bundle';
40
+ } else {
41
+ cachedBaseUrl = process.env.EXPO_BASE_URL ?? '';
42
+ }
43
+ return cachedBaseUrl;
44
+ }
45
+
46
+ // Serving from local dev server
47
+ const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');
48
+ const devServer = getDevServer();
49
+ cachedBaseUrl = new URL('/_expo/@dom', devServer.url).toString();
50
+ return cachedBaseUrl;
51
+ }
@@ -2,6 +2,7 @@
2
2
  import React from 'react';
3
3
  import { AppState } from 'react-native';
4
4
 
5
+ import { getBaseURL } from './base';
5
6
  import type { BridgeMessage, DOMProps, WebViewProps, WebViewRef } from './dom.types';
6
7
  import { _emitGlobalEvent } from './global-events';
7
8
  import {
@@ -18,12 +19,10 @@ import RNWebView from './webview/RNWebView';
18
19
 
19
20
  interface Props {
20
21
  dom: DOMProps;
21
- source: {
22
- uri: string;
23
- };
22
+ filePath: string;
24
23
  }
25
24
 
26
- const RawWebView = React.forwardRef<object, Props>(({ dom, source, ...marshalProps }, ref) => {
25
+ const RawWebView = React.forwardRef<object, Props>(({ dom, filePath, ...marshalProps }, ref) => {
27
26
  if (ref != null && typeof ref === 'object' && ref.current == null) {
28
27
  ref.current = new Proxy(
29
28
  {},
@@ -52,6 +51,7 @@ const RawWebView = React.forwardRef<object, Props>(({ dom, source, ...marshalPro
52
51
  const webView = resolveWebView(dom?.useExpoDOMWebView ?? false);
53
52
  const webviewRef = React.useRef<WebViewRef>(null);
54
53
  const domImperativeHandlePropsRef = React.useRef<string[]>([]);
54
+ const source = { uri: `${getBaseURL()}/${filePath}` };
55
55
  const [containerStyle, setContainerStyle] = React.useState<WebViewProps['containerStyle']>(null);
56
56
 
57
57
  const emit = React.useCallback(