expo 58.0.6 → 58.0.8

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.
@@ -10,7 +10,7 @@ buildscript {
10
10
  }
11
11
 
12
12
  group = 'host.exp.exponent'
13
- version = '58.0.6'
13
+ version = '58.0.8'
14
14
 
15
15
  expoModule {
16
16
  // We can't prebuild the module because it depends on the generated files.
@@ -21,7 +21,7 @@ android {
21
21
  namespace "expo.core"
22
22
  defaultConfig {
23
23
  versionCode 1
24
- versionName "58.0.6"
24
+ versionName "58.0.8"
25
25
  consumerProguardFiles("proguard-rules.pro")
26
26
  }
27
27
  testOptions {
@@ -51,6 +51,14 @@ function asyncRequireImpl(moduleID, paths, moduleName) {
51
51
  // On web, split chunks may already be preloaded via `<script>` tags, so importing
52
52
  // synchronously first prevents double-loading the script
53
53
  if (process.env.EXPO_OS === 'web') {
54
+ const bundlePath = paths?.[String(moduleID)];
55
+ if (Array.isArray(bundlePath)) {
56
+ const loadBundle = globalThis[`${__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`];
57
+ if (loadBundle?.isReady?.(bundlePath)) return importAll();
58
+ const maybeLoadBundlePromise = maybeLoadBundle(moduleID, paths);
59
+ if (maybeLoadBundlePromise != null) return maybeLoadBundlePromise.then(importAll);
60
+ throw new Error(`Cannot import module ${moduleName ?? moduleID}: the async bundle loader is unavailable. ` + `Load the initial Expo bundle before importing these chunks: ${bundlePath.join(', ')}`);
61
+ }
54
62
  try {
55
63
  return importAll();
56
64
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"sources":["async-require/asyncRequireModule.ts"],"sourcesContent":[null],"names":["makeWorkerContent","url","JSON","stringify","maybeLoadBundle","moduleID","paths","loadBundle","globalThis","__METRO_GLOBAL_PREFIX__","stringModuleID","String","bundlePath","undefined","asyncRequireImpl","moduleName","importAll","require","process","env","EXPO_OS","error","maybeLoadBundlePromise","then","asyncRequire","ret","promise","Promise","resolve","_result","unstable_importMaybeSync","prefetch","unstable_resolve","Error","id","unstable_createWorker","workerUrl","workerOpts","crossOriginIsolated","content","URL","createObjectURL","Blob","type","Worker","revokeObjectURL","module","exports"],"mappings":"AAAA;;;;;;;;;;CAUC,GAYD,+DAA+D;AAC/D,yCAAyC;AACzC,iDAAiD;AACjD,mDAAmD;AACnD,4CAA4C;AAC5C,qCAAqC;AACrC,4DAA4D;AAC5D,SAASA,kBAAkBC,GAAW;IACpC,OAAO,CAAC;8BACoB,EAAEC,KAAKC,SAAS,CAACF,KAAK;;;;;;;;;;;EAWlD,CAAC;AACH;AAEA,SAASG,gBAAgBC,QAAgB,EAAEC,KAAyB;IAClE,MAAMC,aAAqD,AAACC,UAAkB,CAC5E,GAAGC,2BAA2B,GAAG,iBAAiB,CAAC,CACpD;IAED,IAAIF,cAAc,MAAM;QACtB,MAAMG,iBAAiBC,OAAON;QAC9B,IAAIC,SAAS,MAAM;YACjB,MAAMM,aAAaN,KAAK,CAACI,eAAe;YACxC,IAAIE,cAAc,MAAM;gBACtB,0DAA0D;gBAC1D,OAAOL,WAAWK;YACpB;QACF;IACF;IAEA,OAAOC;AACT;AAEA,SAASC,iBACPT,QAAgB,EAChBC,KAAyB,EACzBS,UAAmB;IAEnB,MAAMC,YAAY,IAAM,AAACC,QAAoCD,SAAS,CAAIX,UAAUU;IAEpF,gGAAgG;IAChG,4CAA4C;IAC5C,kFAAkF;IAClF,yDAAyD;IACzD,IAAIG,QAAQC,GAAG,CAACC,OAAO,KAAK,OAAO;QACjC,IAAI;YACF,OAAOJ;QACT,EAAE,OAAOK,OAAO;YACd,MAAMC,yBAAyBlB,gBAAgBC,UAAUC;YACzD,IAAIgB,0BAA0B,MAAM;gBAClC,OAAOA,uBAAuBC,IAAI,CAACP;YACrC;YACA,MAAMK;QACR;IACF;IAEA,sFAAsF;IACtF,2EAA2E;IAC3E,MAAMC,yBAAyBlB,gBAAgBC,UAAUC;IACzD,IAAIgB,0BAA0B,MAAM;QAClC,OAAOA,uBAAuBC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AOC,OAAO,GAAGvB"}
1
+ {"version":3,"sources":["async-require/asyncRequireModule.ts"],"sourcesContent":[null],"names":["makeWorkerContent","url","JSON","stringify","maybeLoadBundle","moduleID","paths","loadBundle","globalThis","__METRO_GLOBAL_PREFIX__","stringModuleID","String","bundlePath","undefined","asyncRequireImpl","moduleName","importAll","require","process","env","EXPO_OS","Array","isArray","isReady","maybeLoadBundlePromise","then","Error","join","error","asyncRequire","ret","promise","Promise","resolve","_result","unstable_importMaybeSync","prefetch","unstable_resolve","id","unstable_createWorker","workerUrl","workerOpts","crossOriginIsolated","content","URL","createObjectURL","Blob","type","Worker","revokeObjectURL","module","exports"],"mappings":"AAAA;;;;;;;;;;CAUC,GAYD,+DAA+D;AAC/D,yCAAyC;AACzC,iDAAiD;AACjD,mDAAmD;AACnD,4CAA4C;AAC5C,qCAAqC;AACrC,4DAA4D;AAC5D,SAASA,kBAAkBC,GAAW;IACpC,OAAO,CAAC;8BACoB,EAAEC,KAAKC,SAAS,CAACF,KAAK;;;;;;;;;;;EAWlD,CAAC;AACH;AAEA,SAASG,gBAAgBC,QAAgB,EAAEC,KAAyB;IAClE,MAAMC,aAAqD,AAACC,UAAkB,CAC5E,GAAGC,2BAA2B,GAAG,iBAAiB,CAAC,CACpD;IAED,IAAIF,cAAc,MAAM;QACtB,MAAMG,iBAAiBC,OAAON;QAC9B,IAAIC,SAAS,MAAM;YACjB,MAAMM,aAAaN,KAAK,CAACI,eAAe;YACxC,IAAIE,cAAc,MAAM;gBACtB,0DAA0D;gBAC1D,OAAOL,WAAWK;YACpB;QACF;IACF;IAEA,OAAOC;AACT;AAEA,SAASC,iBACPT,QAAgB,EAChBC,KAAyB,EACzBS,UAAmB;IAEnB,MAAMC,YAAY,IAAM,AAACC,QAAoCD,SAAS,CAAIX,UAAUU;IAEpF,gGAAgG;IAChG,4CAA4C;IAC5C,kFAAkF;IAClF,yDAAyD;IACzD,IAAIG,QAAQC,GAAG,CAACC,OAAO,KAAK,OAAO;QACjC,MA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IAE7BX,gBAAgBC,UAAUC,QAAQmB,KAChC,KAAO,GACP,KAAO;AAEX;AAEAI,aAAaQ,gBAAgB,GAAG,SAASA,iBACvChC,QAAgB,EAChBC,KAAyB;IAEzB,IAAI,CAACA,OAAO;QACV,MAAM,IAAIoB,MAAM;IAClB;IACA,MAAMY,KAAKhC,KAAK,CAACD,SAAS;IAC1B,IAAI,CAACiC,IAAI;QACP,MAAM,IAAIZ,MAAM,uDAAuDY;IACzE;IACA,OAAOA;AACT;AAEA,oGAAoG;AACpG,oGAAoG;AACpG,uFAAuF;AACvFT,aAAaU,qBAAqB,GAAG,SAASA,sBAC5CC,SAAiB,EACjBC,UAA0B;IAE1B,IAAI,OAAOC,wBAAwB,eAAeA,qBAAqB;QACrE,IAAI;YACF,MAAMC,UAAU3C,kBAAkBwC;YAClCA,YAAYI,IAAIC,eAAe,CAAC,IAAIC,KAAK;gBAACH;aAAQ,EAAE;gBAAEI,MAAM;YAAkB;YAC9E,OAAO,IAAIC,OAAOR,WAAWC;QAC/B,SAAU;YACRG,IAAIK,eAAe,CAACT;QACtB;IACF,OAAO;QACL,OAAO,IAAIQ,OAAOR,WAAWC;IAC/B;AACF;AAKAS,OAAOC,OAAO,GAAGtB"}
@@ -8,7 +8,9 @@
8
8
  * Must satisfy the requirements of the Metro bundler.
9
9
  * https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md#__loadbundleasync-in-metro
10
10
  */
11
- type AsyncRequire = (path: string) => Promise<void>;
11
+ type AsyncRequire = ((path: string | readonly string[]) => Promise<void>) & {
12
+ isReady?: (paths: readonly string[]) => boolean;
13
+ };
12
14
  /** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */
13
15
  export declare function buildAsyncRequire(): AsyncRequire;
14
16
  export {};
@@ -3,20 +3,43 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
- */ import { loadBundleAsync } from './loadBundle';
6
+ */ import { buildUrlForBundle } from './buildUrlForBundle';
7
+ import { loadBundleAsync } from './loadBundle';
7
8
  /** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */ export function buildAsyncRequire() {
8
9
  const cache = new Map();
9
- return async function universal_loadBundleAsync(path) {
10
- if (cache.has(path)) {
11
- return cache.get(path);
10
+ const runtime = globalThis;
11
+ // Keep any completions recorded before the loader was installed.
12
+ const registryKey = `${runtime.__METRO_GLOBAL_PREFIX__ ?? ''}__expo_chunk_completion__`;
13
+ const completedUrls = process.env.EXPO_OS === 'web' && process.env.NODE_ENV === 'production' ? runtime[registryKey] ??= new Set() : undefined;
14
+ const getCacheKey = (path)=>{
15
+ if (!completedUrls) return path;
16
+ const url = buildUrlForBundle(path);
17
+ return typeof document === 'undefined' ? url : new URL(url, document.baseURI).href;
18
+ };
19
+ async function loadFileAsync(path, requireCompletion = false) {
20
+ const cacheKey = getCacheKey(path);
21
+ if (completedUrls?.has(cacheKey)) return;
22
+ let promise = cache.get(cacheKey);
23
+ if (!promise) {
24
+ promise = loadBundleAsync(path).catch((error)=>{
25
+ if (cache.get(cacheKey) === promise) cache.delete(cacheKey);
26
+ throw error;
27
+ });
28
+ cache.set(cacheKey, promise);
29
+ }
30
+ await promise;
31
+ // A script can fire 'load' even if it threw before registering every module.
32
+ if (requireCompletion && completedUrls && !completedUrls.has(cacheKey)) {
33
+ if (cache.get(cacheKey) === promise) cache.delete(cacheKey);
34
+ throw new Error(`Chunk ${cacheKey} did not finish registering its modules. ` + 'Check the console for an earlier script error. ' + 'If none is present, report this as an Expo bug.');
12
35
  }
13
- const promise = loadBundleAsync(path).catch((error)=>{
14
- cache.delete(path);
15
- throw error;
16
- });
17
- cache.set(path, promise);
18
- return promise;
36
+ }
37
+ const load = async function universal_loadBundleAsync(path) {
38
+ if (typeof path === 'string') return loadFileAsync(path);
39
+ await Promise.all(path.map((file)=>loadFileAsync(file, true)));
19
40
  };
41
+ if (completedUrls) load.isReady = (paths)=>paths.every((path)=>completedUrls.has(getCacheKey(path)));
42
+ return load;
20
43
  }
21
44
 
22
45
  //# sourceMappingURL=buildAsyncRequire.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["async-require/buildAsyncRequire.ts"],"sourcesContent":[null],"names":["loadBundleAsync","buildAsyncRequire","cache","Map","universal_loadBundleAsync","path","has","get","promise","catch","error","delete","set"],"mappings":"AAAA;;;;;CAKC,GAED,SAASA,eAAe,QAAQ,eAAe;AAQ/C,kFAAkF,GAClF,OAAO,SAASC;IACd,MAAMC,QAAQ,IAAIC;IAElB,OAAO,eAAeC,0BAA0BC,IAAY;QAC1D,IAAIH,MAAMI,GAAG,CAACD,OAAO;YACnB,OAAOH,MAAMK,GAAG,CAACF;QACnB;QAEA,MAAMG,UAAUR,gBAAgBK,MAAMI,KAAK,CAAC,CAACC;YAC3CR,MAAMS,MAAM,CAACN;YACb,MAAMK;QACR;QAEAR,MAAMU,GAAG,CAACP,MAAMG;QAEhB,OAAOA;IACT;AACF"}
1
+ {"version":3,"sources":["async-require/buildAsyncRequire.ts"],"sourcesContent":[null],"names":["buildUrlForBundle","loadBundleAsync","buildAsyncRequire","cache","Map","runtime","globalThis","registryKey","__METRO_GLOBAL_PREFIX__","completedUrls","process","env","EXPO_OS","NODE_ENV","Set","undefined","getCacheKey","path","url","document","URL","baseURI","href","loadFileAsync","requireCompletion","cacheKey","has","promise","get","catch","error","delete","set","Error","load","universal_loadBundleAsync","Promise","all","map","file","isReady","paths","every"],"mappings":"AAAA;;;;;CAKC,GAED,SAASA,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,eAAe,QAAQ,eAAe;AAU/C,kFAAkF,GAClF,OAAO,SAASC;IACd,MAAMC,QAAQ,IAAIC;IAClB,MAAMC,UAAUC;IAChB,iEAAiE;IACjE,MAAMC,cAAc,GAAGF,QAAQG,uBAAuB,IAAI,GAAG,yBAAyB,CAAC;IACvF,MAAMC,gBACJC,QAAQC,GAAG,CAACC,OAAO,KAAK,SAASF,QAAQC,GAAG,CAACE,QAAQ,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0.21.3",
4
- "@expo/metro-runtime": "~58.0.13",
3
+ "@expo/fingerprint": "~0.21.5",
4
+ "@expo/metro-runtime": "~58.0.14",
5
5
  "@expo/vector-icons": "^15.0.2",
6
- "@expo/ui": "~58.0.14",
6
+ "@expo/ui": "~58.0.16",
7
7
  "@react-native-async-storage/async-storage": "2.2.0",
8
8
  "@react-native-community/datetimepicker": "9.2.1",
9
9
  "@react-native-masked-view/masked-view": "0.3.2",
@@ -16,101 +16,101 @@
16
16
  "eslint-config-expo": "~58.0.4",
17
17
  "expo-analytics-amplitude": "~11.3.0",
18
18
  "expo-app-auth": "~11.1.0",
19
- "expo-app-intents": "~0.5.3",
19
+ "expo-app-intents": "~0.5.5",
20
20
  "expo-app-loader-provider": "~8.0.0",
21
21
  "expo-app-metrics": "~58.0.11",
22
22
  "expo-apple-authentication": "~58.0.2",
23
- "expo-application": "~58.0.4",
24
- "expo-asset": "~58.0.13",
25
- "expo-audio": "~58.0.7",
26
- "expo-auth-session": "~58.0.9",
23
+ "expo-application": "~58.1.1",
24
+ "expo-asset": "~58.0.14",
25
+ "expo-audio": "~58.0.9",
26
+ "expo-auth-session": "~58.0.11",
27
27
  "expo-background-fetch": "~58.0.10",
28
28
  "expo-background-task": "~58.0.10",
29
29
  "expo-battery": "~58.0.3",
30
30
  "expo-blur": "~58.0.3",
31
31
  "expo-brightness": "~58.0.2",
32
- "expo-brownfield": "~58.0.12",
32
+ "expo-brownfield": "~58.0.13",
33
33
  "expo-build-properties": "~58.0.10",
34
34
  "expo-calendar": "~58.0.6",
35
- "expo-camera": "~58.0.9",
36
- "expo-cellular": "~58.0.2",
35
+ "expo-camera": "~58.0.10",
36
+ "expo-cellular": "~58.0.3",
37
37
  "expo-checkbox": "~58.0.2",
38
38
  "expo-clipboard": "~58.0.3",
39
- "expo-constants": "~58.0.10",
40
- "expo-contacts": "~58.0.6",
41
- "expo-crypto": "~58.0.5",
42
- "expo-dev-client": "~58.0.11",
39
+ "expo-constants": "~58.0.11",
40
+ "expo-contacts": "~58.0.7",
41
+ "expo-crypto": "~58.0.6",
42
+ "expo-dev-client": "~58.0.13",
43
43
  "expo-device": "~58.0.5",
44
44
  "expo-document-picker": "~58.0.4",
45
45
  "expo-eas-client": "~58.0.2",
46
- "expo-file-system": "~58.0.7",
47
- "expo-font": "~58.0.7",
46
+ "expo-file-system": "~58.0.9",
47
+ "expo-font": "~58.0.8",
48
48
  "expo-gl": "~58.0.3",
49
49
  "expo-glass-effect": "~58.0.3",
50
50
  "expo-google-app-auth": "~8.3.0",
51
- "expo-haptics": "~58.0.5",
52
- "expo-hinge": "~58.0.0",
53
- "expo-image": "~58.0.13",
51
+ "expo-haptics": "~58.0.6",
52
+ "expo-hinge": "~58.0.1",
53
+ "expo-image": "~58.0.14",
54
54
  "expo-image-loader": "~58.0.3",
55
- "expo-image-manipulator": "~58.0.13",
55
+ "expo-image-manipulator": "~58.0.14",
56
56
  "expo-image-picker": "~58.0.10",
57
57
  "expo-intent-launcher": "~58.0.3",
58
58
  "expo-insights": "~58.0.11",
59
59
  "expo-keep-awake": "~58.0.3",
60
60
  "expo-linear-gradient": "~58.0.3",
61
- "expo-linking": "~58.0.11",
61
+ "expo-linking": "~58.0.12",
62
62
  "expo-local-authentication": "~58.0.2",
63
- "expo-localization": "~58.0.3",
64
- "expo-location": "~58.0.12",
63
+ "expo-localization": "~58.0.4",
64
+ "expo-location": "~58.0.14",
65
65
  "expo-mail-composer": "~58.0.3",
66
66
  "expo-manifests": "~58.0.1",
67
- "expo-maps": "~58.0.7",
67
+ "expo-maps": "~58.0.9",
68
68
  "expo-mcp": "~0.2.1",
69
- "expo-media-library": "~58.0.7",
69
+ "expo-media-library": "~58.0.8",
70
70
  "expo-mesh-gradient": "~58.0.3",
71
- "expo-module-template": "~58.0.5",
72
- "expo-modules-core": "~58.0.14",
71
+ "expo-module-template": "~58.0.6",
72
+ "expo-modules-core": "~58.0.16",
73
73
  "expo-navigation-bar": "~58.0.4",
74
74
  "expo-network": "~58.0.3",
75
- "expo-notifications": "~58.1.1",
75
+ "expo-notifications": "~58.1.3",
76
76
  "expo-observe": "~58.0.13",
77
- "expo-print": "~58.0.5",
78
- "expo-live-photo": "~58.0.4",
79
- "expo-router": "~58.0.16",
77
+ "expo-print": "~58.0.6",
78
+ "expo-live-photo": "~58.0.5",
79
+ "expo-router": "~58.0.18",
80
80
  "expo-screen-capture": "~58.0.5",
81
- "expo-screen-orientation": "~58.0.2",
81
+ "expo-screen-orientation": "~58.0.3",
82
82
  "expo-secure-store": "~58.0.2",
83
- "expo-sensors": "~58.0.2",
84
- "expo-server": "~58.0.3",
85
- "expo-sharing": "~58.0.15",
83
+ "expo-sensors": "~58.0.4",
84
+ "expo-server": "~58.0.5",
85
+ "expo-sharing": "~58.0.17",
86
86
  "expo-sms": "~58.0.2",
87
87
  "expo-speech": "~58.0.3",
88
- "expo-splash-screen": "~58.0.6",
89
- "expo-sqlite": "~58.0.10",
88
+ "expo-splash-screen": "~58.0.8",
89
+ "expo-sqlite": "~58.0.12",
90
90
  "expo-status-bar": "~58.0.3",
91
91
  "expo-store-review": "~58.0.2",
92
92
  "expo-symbols": "~58.0.4",
93
93
  "expo-system-ui": "~58.0.5",
94
94
  "expo-task-manager": "~58.0.11",
95
95
  "expo-tracking-transparency": "~58.0.2",
96
- "expo-updates": "~58.0.15",
96
+ "expo-updates": "~58.0.16",
97
97
  "expo-video-thumbnails": "~58.0.2",
98
- "expo-video": "~58.0.8",
98
+ "expo-video": "~58.0.10",
99
99
  "expo-web-browser": "~58.0.6",
100
- "expo-widgets": "~58.0.14",
101
- "jest-expo": "~58.0.8",
100
+ "expo-widgets": "~58.0.16",
101
+ "jest-expo": "~58.0.9",
102
102
  "lottie-react-native": "~7.5.0",
103
103
  "react": "19.3.0",
104
104
  "react-dom": "19.3.0",
105
- "react-native": "0.88.0-rc.3",
106
- "react-native-web": "~0.21.3",
105
+ "react-native": "0.88.0-rc.4",
106
+ "react-native-web": "~0.21.4",
107
107
  "react-native-gesture-handler": "~3.2.1",
108
108
  "react-native-keyboard-controller": "1.22.4",
109
109
  "react-native-maps": "1.29.0",
110
110
  "react-native-pager-view": "9.0.4",
111
111
  "react-native-worklets": "0.13.0",
112
112
  "react-native-reanimated": "4.7.0",
113
- "react-native-screens": "~4.28.0",
113
+ "react-native-screens": "~4.29.0",
114
114
  "react-native-safe-area-context": "~5.9.1",
115
115
  "react-native-svg": "15.15.5",
116
116
  "react-native-view-shot": "5.1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo",
3
- "version": "58.0.6",
3
+ "version": "58.0.8",
4
4
  "description": "The Expo SDK",
5
5
  "keywords": [
6
6
  "expo"
@@ -202,39 +202,39 @@
202
202
  },
203
203
  "dependencies": {
204
204
  "@babel/runtime": "^7.20.0",
205
- "@expo/cli": "^58.1.5",
206
- "@expo/config": "~58.0.3",
207
- "@expo/config-plugins": "~58.0.6",
205
+ "@expo/cli": "^58.1.7",
206
+ "@expo/config": "~58.0.5",
207
+ "@expo/config-plugins": "~58.0.8",
208
208
  "@expo/devtools": "~58.0.2",
209
209
  "@expo/dom-webview": "~58.0.2",
210
- "@expo/fingerprint": "^0.21.3",
211
- "@expo/local-build-cache-provider": "^58.0.3",
212
- "@expo/log-box": "^58.0.11",
213
- "@expo/log-box-utils": "^58.0.1",
210
+ "@expo/fingerprint": "^0.21.5",
211
+ "@expo/local-build-cache-provider": "^58.0.5",
212
+ "@expo/log-box": "^58.0.12",
213
+ "@expo/log-box-utils": "^58.0.2",
214
214
  "@expo/metro": "~58.0.0-rc.0",
215
- "@expo/metro-config": "~58.0.10",
215
+ "@expo/metro-config": "~58.0.12",
216
216
  "@ungap/structured-clone": "^1.3.0",
217
- "babel-preset-expo": "~58.0.11",
218
- "expo-asset": "~58.0.13",
219
- "expo-constants": "~58.0.10",
220
- "expo-file-system": "~58.0.7",
221
- "expo-font": "~58.0.7",
217
+ "babel-preset-expo": "~58.0.13",
218
+ "expo-asset": "~58.0.14",
219
+ "expo-constants": "~58.0.11",
220
+ "expo-file-system": "~58.0.9",
221
+ "expo-font": "~58.0.8",
222
222
  "expo-keep-awake": "~58.0.3",
223
- "expo-modules-autolinking": "~58.0.10",
224
- "expo-modules-core": "~58.0.14",
223
+ "expo-modules-autolinking": "~58.0.12",
224
+ "expo-modules-core": "~58.0.16",
225
225
  "pretty-format": "^29.7.0",
226
226
  "react-refresh": "^0.14.2",
227
227
  "whatwg-url-minimum": "^0.2.0"
228
228
  },
229
229
  "devDependencies": {
230
- "@expo/metro-runtime": "58.0.13",
230
+ "@expo/metro-runtime": "58.0.14",
231
231
  "@types/node": "^22.14.0",
232
232
  "@types/react": "~19.3.0",
233
- "expo-updates": "58.0.15",
233
+ "expo-updates": "58.0.16",
234
234
  "npm-run-all2": "^8.0.4",
235
235
  "react": "19.3.0",
236
236
  "react-dom": "19.3.0",
237
- "react-native": "0.88.0-rc.3",
237
+ "react-native": "0.88.0-rc.4",
238
238
  "rimraf": "^6.1.2",
239
239
  "web-streams-polyfill": "^3.3.2"
240
240
  },
@@ -265,13 +265,13 @@
265
265
  }
266
266
  },
267
267
  "jest": {
268
- "preset": "../expo-module-scripts/jest-preset.cjs"
268
+ "preset": "../@expo/internal-scripts/jest-preset.cjs"
269
269
  },
270
270
  "engines": {
271
271
  "node": "^22.13.0 || ^24.3.0 || ^26.0.0 || >=27.0.0"
272
272
  },
273
273
  "scripts": {
274
- "build": "../expo-module-scripts/bin/expo-build src",
274
+ "build": "../@expo/internal-scripts/bin/expo-build src",
275
275
  "clean": "rimraf build",
276
276
  "lint": "oxlint --config oxlint.config.mjs .",
277
277
  "format": "expo-module format",
@@ -27,12 +27,13 @@ function valueOf(argv, flag) {
27
27
  }
28
28
 
29
29
  describe('generateModulesProvider', () => {
30
- it('always passes the target, app root and platform', () => {
30
+ it('always passes the target, app root and platforms', () => {
31
31
  const argv = argvFor({});
32
32
  expect(argv[1]).toBe('generate-modules-provider');
33
33
  expect(valueOf(argv, '--target')).toMatch(/ExpoModulesProvider\.swift$/);
34
34
  expect(valueOf(argv, '--app-root')).toBe(path.join(os.tmpdir(), 'app'));
35
35
  expect(valueOf(argv, '--platform')).toBe('apple');
36
+ expect(valueOf(argv, '--target-platform')).toBe('ios');
36
37
  });
37
38
 
38
39
  it('passes the app target name, entitlements and Podfile properties when resolved', () => {
@@ -9,7 +9,7 @@ const { scriptPhasesForModules } = require('../script-phases');
9
9
 
10
10
  const REPO_ROOT = path.resolve(__dirname, '../../../../..');
11
11
  const WITH_NODE_COPIES = [
12
- 'packages/expo-module-scripts/templates/scripts/with-node.sh',
12
+ 'packages/@expo/internal-scripts/templates/scripts/with-node.sh',
13
13
  'packages/expo-constants/scripts/with-node.sh',
14
14
  'packages/expo-updates/scripts/with-node.sh',
15
15
  'packages/expo-widgets/scripts/with-node.sh',
@@ -78,6 +78,9 @@ function generateModulesProvider({
78
78
  appRoot,
79
79
  '--platform',
80
80
  'apple',
81
+ // The generated SwiftPM manifests target iOS only.
82
+ '--target-platform',
83
+ 'ios',
81
84
  ...(targetName != null ? ['--target-name', targetName] : []),
82
85
  ...(entitlementPath != null ? ['--entitlement', entitlementPath] : []),
83
86
  ...(podfilePropertiesPath != null
@@ -33,8 +33,7 @@ describe('asyncRequireModule', () => {
33
33
  // Clear any previous __loadBundleAsync
34
34
  delete (globalThis as any).__loadBundleAsync;
35
35
 
36
- // Evaluate the compiled module in a scope where `require` is our mock.
37
- // We use Function constructor to create a scope with our own `require`.
36
+ // This is a handwritten copy. Keep it in sync with asyncRequireModule.ts.
38
37
  const moduleObj = { exports: {} as any };
39
38
  // eslint-disable-next-line no-new-func
40
39
  const moduleFn = new Function(
@@ -68,6 +67,17 @@ describe('asyncRequireModule', () => {
68
67
 
69
68
  // On web, importing synchronously first prevents double-loading preloaded scripts
70
69
  if (process.env.EXPO_OS === 'web') {
70
+ var bundlePath = paths && paths[String(moduleID)];
71
+ if (Array.isArray(bundlePath)) {
72
+ var loadBundle = globalThis[(__METRO_GLOBAL_PREFIX__ || '') + '__loadBundleAsync'];
73
+ if (loadBundle && loadBundle.isReady && loadBundle.isReady(bundlePath)) return importAll();
74
+ var maybeLoadBundlePromise = maybeLoadBundle(moduleID, paths);
75
+ if (maybeLoadBundlePromise != null) return maybeLoadBundlePromise.then(importAll);
76
+ throw new Error(
77
+ 'Cannot import module ' + (moduleName == null ? moduleID : moduleName) + ': the async bundle loader is unavailable. ' +
78
+ 'Load the initial Expo bundle before importing these chunks: ' + bundlePath.join(', ')
79
+ );
80
+ }
71
81
  try {
72
82
  return importAll();
73
83
  } catch (error) {
@@ -124,6 +134,49 @@ describe('asyncRequireModule', () => {
124
134
  expect(result).toEqual({ default: 'module-42' });
125
135
  });
126
136
 
137
+ it.each([false, true])(
138
+ 'waits before running a partially registered array (maybeSync: %s)',
139
+ async (maybeSync) => {
140
+ process.env.EXPO_OS = 'web';
141
+ let finish!: () => void;
142
+ const loader = Object.assign(
143
+ jest.fn(
144
+ () =>
145
+ new Promise<void>((resolve) => {
146
+ finish = resolve;
147
+ })
148
+ ),
149
+ { isReady: () => false }
150
+ );
151
+ (globalThis as any).__loadBundleAsync = loader;
152
+ const result = maybeSync
153
+ ? asyncRequire.unstable_importMaybeSync(42, { 42: ['/shared.js'] })
154
+ : asyncRequire(42, { 42: ['/shared.js'] });
155
+ expect(mockImportAll).not.toHaveBeenCalled();
156
+ finish();
157
+ await expect(result).resolves.toEqual({ default: 'module-42' });
158
+ expect(mockImportAll).toHaveBeenCalledTimes(1);
159
+ }
160
+ );
161
+
162
+ it('preserves synchronous hydration for confirmed-ready arrays', () => {
163
+ process.env.EXPO_OS = 'web';
164
+ const loader = Object.assign(jest.fn(), { isReady: () => true });
165
+ (globalThis as any).__loadBundleAsync = loader;
166
+ const result = asyncRequire(42, { 42: ['/shared.js', '/route.js'] });
167
+ expect(result._result).toEqual({ default: 'module-42' });
168
+ expect(asyncRequire.unstable_importMaybeSync(42, { 42: ['/route.js'] })).toEqual({
169
+ default: 'module-42',
170
+ });
171
+ expect(loader).not.toHaveBeenCalled();
172
+ });
173
+
174
+ it('does not attempt factory execution for an array without a loader', () => {
175
+ process.env.EXPO_OS = 'web';
176
+ expect(() => asyncRequire(42, { 42: ['/shared.js'] })).toThrow('loader');
177
+ expect(mockImportAll).not.toHaveBeenCalled();
178
+ });
179
+
127
180
  it('calls importAll without moduleName when not provided', async () => {
128
181
  const result = await asyncRequire(42, null);
129
182
 
@@ -202,6 +255,24 @@ describe('asyncRequireModule', () => {
202
255
  expect(result).toEqual({ default: 'module-42' });
203
256
  });
204
257
 
258
+ it('forwards array payloads opaquely and waits before importing on native', async () => {
259
+ process.env.EXPO_OS = 'ios';
260
+ let finish!: () => void;
261
+ (globalThis as any).__loadBundleAsync = jest.fn(
262
+ () =>
263
+ new Promise<void>((resolve) => {
264
+ finish = resolve;
265
+ })
266
+ );
267
+ const payload = ['/shared.js', '/route.js'];
268
+ const result = asyncRequire(42, { '42': payload }, 'route');
269
+ expect((globalThis as any).__loadBundleAsync).toHaveBeenCalledWith(payload);
270
+ expect(mockImportAll).not.toHaveBeenCalled();
271
+ finish();
272
+ await expect(result).resolves.toEqual({ default: 'module-42' });
273
+ expect(mockImportAll).toHaveBeenCalledTimes(1);
274
+ });
275
+
205
276
  it('imports synchronously on native when the module is inlined (no split bundle path)', () => {
206
277
  process.env.EXPO_OS = 'ios';
207
278
  (globalThis as any).__loadBundleAsync = jest.fn(() => Promise.resolve());
@@ -267,6 +338,13 @@ describe('asyncRequireModule', () => {
267
338
  });
268
339
 
269
340
  describe('prefetch', () => {
341
+ it('forwards arrays without executing a factory', async () => {
342
+ (globalThis as any).__loadBundleAsync = jest.fn(async () => {});
343
+ const payload = ['/shared.js', '/route.js'];
344
+ asyncRequire.prefetch(42, { '42': payload }, 'route');
345
+ expect((globalThis as any).__loadBundleAsync).toHaveBeenCalledWith(payload);
346
+ expect(mockImportAll).not.toHaveBeenCalled();
347
+ });
270
348
  it('does not call importAll (only triggers bundle loading)', () => {
271
349
  (globalThis as any).__loadBundleAsync = jest.fn(() => Promise.resolve());
272
350
 
@@ -7,10 +7,14 @@ export const asMock = <T extends (...args: any[]) => any>(fn: T): jest.MockedFun
7
7
  jest.mock('../loadBundle', () => ({
8
8
  loadBundleAsync: jest.fn(async () => {}),
9
9
  }));
10
+ jest.mock('../buildUrlForBundle', () => ({
11
+ buildUrlForBundle: (path: string) => new URL(path, 'https://example.com/nested/page').href,
12
+ }));
10
13
 
11
14
  const originalEnv = process.env.NODE_ENV;
12
15
  beforeEach(() => {
13
16
  process.env.NODE_ENV = 'development';
17
+ asMock(loadBundleAsync).mockReset().mockResolvedValue();
14
18
  });
15
19
 
16
20
  afterAll(() => {
@@ -31,3 +35,206 @@ it(`loads the module with \`loadBundleAsync\` if the module has not been loaded
31
35
  // Did attempt to fetch the bundle
32
36
  expect(loadBundleAsync).toHaveBeenCalledWith('/bacon.bundle?platform=ios');
33
37
  });
38
+
39
+ it('loads arrays per file and waits for every file, regardless of completion order', async () => {
40
+ let resolveSharedLoad!: () => void;
41
+ let resolveRouteLoad!: () => void;
42
+ asMock(loadBundleAsync)
43
+ .mockImplementationOnce(
44
+ () =>
45
+ new Promise((resolve) => {
46
+ resolveSharedLoad = resolve;
47
+ })
48
+ )
49
+ .mockImplementationOnce(
50
+ () =>
51
+ new Promise((resolve) => {
52
+ resolveRouteLoad = resolve;
53
+ })
54
+ );
55
+ const onLoaded = jest.fn();
56
+ const result = buildAsyncRequire()(['/shared.js', '/route.js']).then(onLoaded);
57
+ expect(asMock(loadBundleAsync).mock.calls).toEqual([['/shared.js'], ['/route.js']]);
58
+ resolveRouteLoad();
59
+ await Promise.resolve();
60
+ expect(onLoaded).not.toHaveBeenCalled();
61
+ resolveSharedLoad();
62
+ await result;
63
+ expect(onLoaded).toHaveBeenCalledTimes(1);
64
+ });
65
+
66
+ it('deduplicates pending and fulfilled files across overlapping arrays and scalar requests', async () => {
67
+ let resolveSharedLoad!: () => void;
68
+ asMock(loadBundleAsync).mockImplementation((path) =>
69
+ path === '/shared.js'
70
+ ? new Promise((resolve) => {
71
+ resolveSharedLoad = resolve;
72
+ })
73
+ : Promise.resolve()
74
+ );
75
+ const asyncRequire = buildAsyncRequire();
76
+ const first = asyncRequire(['/shared.js', '/a.js', '/shared.js']);
77
+ const second = asyncRequire(['/shared.js', '/b.js']);
78
+ const scalar = asyncRequire('/shared.js');
79
+ expect(asMock(loadBundleAsync).mock.calls).toEqual([['/shared.js'], ['/a.js'], ['/b.js']]);
80
+ resolveSharedLoad();
81
+ await Promise.all([first, second, scalar]);
82
+ await asyncRequire(['/a.js', '/shared.js', '/b.js']);
83
+ expect(loadBundleAsync).toHaveBeenCalledTimes(3);
84
+ });
85
+
86
+ it('retries only a failed file, keeping successful array members cached', async () => {
87
+ const failure = new Error('network error');
88
+ asMock(loadBundleAsync)
89
+ .mockResolvedValueOnce()
90
+ .mockRejectedValueOnce(failure)
91
+ .mockResolvedValueOnce();
92
+ const asyncRequire = buildAsyncRequire();
93
+ await expect(asyncRequire(['/shared.js', '/route.js'])).rejects.toBe(failure);
94
+ await expect(asyncRequire(['/shared.js', '/route.js'])).resolves.toBeUndefined();
95
+ expect(asMock(loadBundleAsync).mock.calls).toEqual([
96
+ ['/shared.js'],
97
+ ['/route.js'],
98
+ ['/route.js'],
99
+ ]);
100
+ });
101
+
102
+ it('shares a rejection between concurrent callers and evicts it for a scalar retry', async () => {
103
+ const failure = new Error('load failed');
104
+ asMock(loadBundleAsync).mockRejectedValueOnce(failure).mockResolvedValueOnce();
105
+ const asyncRequire = buildAsyncRequire();
106
+ const first = asyncRequire(['/shared.js']);
107
+ const second = asyncRequire('/shared.js');
108
+ await expect(first).rejects.toBe(failure);
109
+ await expect(second).rejects.toBe(failure);
110
+ await expect(asyncRequire('/shared.js')).resolves.toBeUndefined();
111
+ expect(asMock(loadBundleAsync).mock.calls).toEqual([['/shared.js'], ['/shared.js']]);
112
+ });
113
+
114
+ it('accepts an empty array without making a request', async () => {
115
+ await expect(buildAsyncRequire()([])).resolves.toBeUndefined();
116
+ expect(loadBundleAsync).not.toHaveBeenCalled();
117
+ });
118
+
119
+ it('does not share a cache between loader installations', async () => {
120
+ await buildAsyncRequire()('/route.js');
121
+ await buildAsyncRequire()('/route.js');
122
+ expect(asMock(loadBundleAsync).mock.calls).toEqual([['/route.js'], ['/route.js']]);
123
+ });
124
+
125
+ (process.env.EXPO_OS === 'web' ? describe : describe.skip)('web chunk readiness', () => {
126
+ const originalPlatform = process.env.EXPO_OS;
127
+ beforeEach(() => {
128
+ process.env.EXPO_OS = 'web';
129
+ process.env.NODE_ENV = 'production';
130
+ delete (globalThis as any).__expo_chunk_completion__;
131
+ asMock(loadBundleAsync).mockImplementation(async (path) => {
132
+ const runtime = globalThis as any;
133
+ const key = `${runtime.__METRO_GLOBAL_PREFIX__ ?? ''}__expo_chunk_completion__`;
134
+ // Simulate the chunk footer.
135
+ runtime[key].add(new URL(path, 'https://example.com/nested/page').href);
136
+ });
137
+ });
138
+ afterEach(() => {
139
+ process.env.EXPO_OS = originalPlatform;
140
+ delete (globalThis as any).__expo_chunk_completion__;
141
+ });
142
+
143
+ it('preserves early footer records and observes later ones without refetching', async () => {
144
+ const completedUrls = new Set(['https://example.com/shared.js']);
145
+ (globalThis as any).__expo_chunk_completion__ = completedUrls;
146
+ const asyncRequire = buildAsyncRequire();
147
+ expect(asyncRequire.isReady?.(['/shared.js', '/route.js'])).toBe(false);
148
+ completedUrls.add('https://example.com/route.js');
149
+ expect(asyncRequire.isReady?.(['/shared.js', '/route.js'])).toBe(true);
150
+ await asyncRequire(['/shared.js', '/route.js']);
151
+ expect(loadBundleAsync).not.toHaveBeenCalled();
152
+ });
153
+
154
+ it('does not call a pending or rejected file ready, and retries it', async () => {
155
+ let reject!: (error: Error) => void;
156
+ asMock(loadBundleAsync).mockImplementationOnce(
157
+ () =>
158
+ new Promise((_, fail) => {
159
+ reject = fail;
160
+ })
161
+ );
162
+ const asyncRequire = buildAsyncRequire();
163
+ const pendingLoad = asyncRequire(['/route.js']);
164
+ expect(asyncRequire.isReady?.(['/route.js'])).toBe(false);
165
+ reject(new Error('failed'));
166
+ await expect(pendingLoad).rejects.toThrow('failed');
167
+ expect(asyncRequire.isReady?.(['/route.js'])).toBe(false);
168
+ await asyncRequire(['/route.js']);
169
+ expect(asyncRequire.isReady?.(['/route.js'])).toBe(true);
170
+ });
171
+
172
+ it('uses the loader URL, not a differing document base, and retains query strings', async () => {
173
+ (globalThis as any).__expo_chunk_completion__ = new Set(['https://example.com/base/route.js']);
174
+ const asyncRequire = buildAsyncRequire();
175
+ expect(asyncRequire.isReady?.(['route.js'])).toBe(false);
176
+ await asyncRequire(['route.js']);
177
+ expect(loadBundleAsync).toHaveBeenCalledWith('route.js');
178
+ expect(asyncRequire.isReady?.(['https://example.com/nested/route.js'])).toBe(true);
179
+ expect(asyncRequire.isReady?.(['route.js?v=2'])).toBe(false);
180
+ });
181
+
182
+ it('rejects incomplete registration and retries only the file without a footer', async () => {
183
+ asMock(loadBundleAsync).mockResolvedValueOnce();
184
+ const asyncRequire = buildAsyncRequire();
185
+ const importAll = jest.fn();
186
+ await expect(asyncRequire(['/shared.js', '/route.js']).then(importAll)).rejects.toThrow(
187
+ /shared\.js.*did not finish registering/
188
+ );
189
+ expect(importAll).not.toHaveBeenCalled();
190
+ expect(asyncRequire.isReady?.(['/shared.js'])).toBe(false);
191
+ expect(asyncRequire.isReady?.(['/route.js'])).toBe(true);
192
+
193
+ await asyncRequire(['/shared.js', '/route.js']).then(importAll);
194
+ expect(importAll).toHaveBeenCalledTimes(1);
195
+ expect(asMock(loadBundleAsync).mock.calls).toEqual([
196
+ ['/shared.js'],
197
+ ['/route.js'],
198
+ ['/shared.js'],
199
+ ]);
200
+ });
201
+
202
+ it('does not promote a fulfilled scalar load into array readiness', async () => {
203
+ asMock(loadBundleAsync).mockResolvedValueOnce();
204
+ const asyncRequire = buildAsyncRequire();
205
+ await asyncRequire('/route.js');
206
+ expect(asyncRequire.isReady?.(['/route.js'])).toBe(false);
207
+ await expect(asyncRequire(['/route.js'])).rejects.toThrow(/did not finish registering/);
208
+ await asyncRequire(['/route.js']);
209
+ expect(asyncRequire.isReady?.(['/route.js'])).toBe(true);
210
+ expect(loadBundleAsync).toHaveBeenCalledTimes(2);
211
+ });
212
+
213
+ it('rejects concurrent incomplete loads and caches a successful retry', async () => {
214
+ asMock(loadBundleAsync).mockResolvedValueOnce();
215
+ const asyncRequire = buildAsyncRequire();
216
+ const first = asyncRequire(['/route.js']).catch(() => asyncRequire(['/route.js']));
217
+ const second = asyncRequire(['/route.js']);
218
+ await expect(second).rejects.toThrow(/did not finish registering/);
219
+ await first;
220
+ await asyncRequire(['/route.js']);
221
+ expect(asyncRequire.isReady?.(['/route.js'])).toBe(true);
222
+ expect(loadBundleAsync).toHaveBeenCalledTimes(2);
223
+ });
224
+
225
+ it('isolates Metro prefixes', async () => {
226
+ const runtime = globalThis as any;
227
+ const originalPrefix = runtime.__METRO_GLOBAL_PREFIX__;
228
+ try {
229
+ runtime.__METRO_GLOBAL_PREFIX__ = 'other';
230
+ const prefixedAsyncRequire = buildAsyncRequire();
231
+ await prefixedAsyncRequire(['/shared.js']);
232
+ expect(prefixedAsyncRequire.isReady?.(['/shared.js'])).toBe(true);
233
+ runtime.__METRO_GLOBAL_PREFIX__ = '';
234
+ expect(buildAsyncRequire().isReady?.(['/shared.js'])).toBe(false);
235
+ } finally {
236
+ runtime.__METRO_GLOBAL_PREFIX__ = originalPrefix;
237
+ delete runtime.other__expo_chunk_completion__;
238
+ }
239
+ });
240
+ });
@@ -74,6 +74,17 @@ function asyncRequireImpl<T>(
74
74
  // On web, split chunks may already be preloaded via `<script>` tags, so importing
75
75
  // synchronously first prevents double-loading the script
76
76
  if (process.env.EXPO_OS === 'web') {
77
+ const bundlePath = paths?.[String(moduleID)];
78
+ if (Array.isArray(bundlePath)) {
79
+ const loadBundle = (globalThis as any)[`${__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`];
80
+ if (loadBundle?.isReady?.(bundlePath)) return importAll();
81
+ const maybeLoadBundlePromise = maybeLoadBundle(moduleID, paths);
82
+ if (maybeLoadBundlePromise != null) return maybeLoadBundlePromise.then(importAll);
83
+ throw new Error(
84
+ `Cannot import module ${moduleName ?? moduleID}: the async bundle loader is unavailable. ` +
85
+ `Load the initial Expo bundle before importing these chunks: ${bundlePath.join(', ')}`
86
+ );
87
+ }
77
88
  try {
78
89
  return importAll();
79
90
  } catch (error) {
@@ -5,30 +5,62 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ import { buildUrlForBundle } from './buildUrlForBundle';
8
9
  import { loadBundleAsync } from './loadBundle';
9
10
 
10
11
  /**
11
12
  * Must satisfy the requirements of the Metro bundler.
12
13
  * https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md#__loadbundleasync-in-metro
13
14
  */
14
- type AsyncRequire = (path: string) => Promise<void>;
15
+ type AsyncRequire = ((path: string | readonly string[]) => Promise<void>) & {
16
+ isReady?: (paths: readonly string[]) => boolean;
17
+ };
15
18
 
16
19
  /** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */
17
20
  export function buildAsyncRequire(): AsyncRequire {
18
21
  const cache = new Map<string, Promise<void>>();
22
+ const runtime = globalThis as typeof globalThis & Record<string, unknown>;
23
+ // Keep any completions recorded before the loader was installed.
24
+ const registryKey = `${runtime.__METRO_GLOBAL_PREFIX__ ?? ''}__expo_chunk_completion__`;
25
+ const completedUrls =
26
+ process.env.EXPO_OS === 'web' && process.env.NODE_ENV === 'production'
27
+ ? ((runtime[registryKey] ??= new Set<string>()) as Set<string>)
28
+ : undefined;
29
+ const getCacheKey = (path: string): string => {
30
+ if (!completedUrls) return path;
31
+ const url = buildUrlForBundle(path);
32
+ return typeof document === 'undefined' ? url : new URL(url, document.baseURI).href;
33
+ };
19
34
 
20
- return async function universal_loadBundleAsync(path: string): Promise<void> {
21
- if (cache.has(path)) {
22
- return cache.get(path)!;
35
+ async function loadFileAsync(path: string, requireCompletion = false): Promise<void> {
36
+ const cacheKey = getCacheKey(path);
37
+ if (completedUrls?.has(cacheKey)) return;
38
+ let promise = cache.get(cacheKey);
39
+ if (!promise) {
40
+ promise = loadBundleAsync(path).catch((error) => {
41
+ if (cache.get(cacheKey) === promise) cache.delete(cacheKey);
42
+ throw error;
43
+ });
44
+ cache.set(cacheKey, promise);
23
45
  }
24
46
 
25
- const promise = loadBundleAsync(path).catch((error) => {
26
- cache.delete(path);
27
- throw error;
28
- });
29
-
30
- cache.set(path, promise);
47
+ await promise;
48
+ // A script can fire 'load' even if it threw before registering every module.
49
+ if (requireCompletion && completedUrls && !completedUrls.has(cacheKey)) {
50
+ if (cache.get(cacheKey) === promise) cache.delete(cacheKey);
51
+ throw new Error(
52
+ `Chunk ${cacheKey} did not finish registering its modules. ` +
53
+ 'Check the console for an earlier script error. ' +
54
+ 'If none is present, report this as an Expo bug.'
55
+ );
56
+ }
57
+ }
31
58
 
32
- return promise;
59
+ const load: AsyncRequire = async function universal_loadBundleAsync(path): Promise<void> {
60
+ if (typeof path === 'string') return loadFileAsync(path);
61
+ await Promise.all(path.map((file) => loadFileAsync(file, true)));
33
62
  };
63
+ if (completedUrls)
64
+ load.isReady = (paths) => paths.every((path) => completedUrls.has(getCacheKey(path)));
65
+ return load;
34
66
  }
package/template.tgz CHANGED
Binary file
@@ -37,18 +37,8 @@ declare module 'react-native' {
37
37
  /** @platform web */
38
38
  backgroundClip?: string;
39
39
  /** @platform web */
40
- backgroundImage?: string;
41
- /** @platform web */
42
40
  backgroundOrigin?: 'border-box' | 'content-box' | 'padding-box';
43
41
  /** @platform web */
44
- backgroundPosition?: string;
45
- /** @platform web */
46
- backgroundRepeat?: string;
47
- /** @platform web */
48
- backgroundSize?: string;
49
- /** @platform web */
50
- boxSizing?: string;
51
- /** @platform web */
52
42
  clip?: string;
53
43
  /** @platform web */
54
44
  gridAutoColumns?: string;
@@ -148,26 +138,12 @@ declare module 'react-native' {
148
138
  /** @platform web */
149
139
  backgroundClip?: string;
150
140
  /** @platform web */
151
- backgroundImage?: string;
152
- /** @platform web */
153
141
  backgroundOrigin?: 'border-box' | 'content-box' | 'padding-box';
154
142
  /** @platform web */
155
- backgroundPosition?: string;
156
- /** @platform web */
157
- backgroundRepeat?: string;
158
- /** @platform web */
159
- backgroundSize?: string;
160
- /** @platform web */
161
- boxShadow?: string;
162
- /** @platform web */
163
- boxSizing?: string;
164
- /** @platform web */
165
143
  clip?: string;
166
144
  /** @platform web */
167
145
  cursor?: string;
168
146
  /** @platform web */
169
- filter?: string;
170
- /** @platform web */
171
147
  gridAutoColumns?: string;
172
148
  /** @platform web */
173
149
  gridAutoFlow?: string;
@@ -194,8 +170,6 @@ declare module 'react-native' {
194
170
  /** @platform web */
195
171
  outline?: string;
196
172
  /** @platform web */
197
- outlineColor?: string;
198
- /** @platform web */
199
173
  overflowX?: string;
200
174
  /** @platform web */
201
175
  overflowY?: string;
@@ -261,7 +235,7 @@ declare module 'react-native' {
261
235
  // PressableProps & React.RefAttributes<RN.View>
262
236
  // >;
263
237
 
264
- interface FlatListProps<ItemT> extends RN.VirtualizedListProps<ItemT> {
238
+ interface FlatListProps<ItemT> {
265
239
  className?: string;
266
240
  }
267
241