expo-asset 8.4.4 → 8.5.0

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +23 -5
  2. package/README.md +3 -3
  3. package/build/Asset.d.ts +1 -0
  4. package/build/Asset.d.ts.map +1 -0
  5. package/build/Asset.fx.d.ts +1 -0
  6. package/build/Asset.fx.d.ts.map +1 -0
  7. package/build/Asset.fx.js +1 -1
  8. package/build/Asset.fx.js.map +1 -1
  9. package/build/AssetHooks.d.ts +1 -0
  10. package/build/AssetHooks.d.ts.map +1 -0
  11. package/build/AssetRegistry.d.ts +1 -0
  12. package/build/AssetRegistry.d.ts.map +1 -0
  13. package/build/AssetRegistry.web.d.ts +1 -0
  14. package/build/AssetRegistry.web.d.ts.map +1 -0
  15. package/build/AssetSourceResolver.d.ts +1 -0
  16. package/build/AssetSourceResolver.d.ts.map +1 -0
  17. package/build/AssetSourceResolver.web.d.ts +1 -0
  18. package/build/AssetSourceResolver.web.d.ts.map +1 -0
  19. package/build/AssetSources.d.ts +1 -0
  20. package/build/AssetSources.d.ts.map +1 -0
  21. package/build/AssetSources.js +12 -2
  22. package/build/AssetSources.js.map +1 -1
  23. package/build/AssetUris.d.ts +3 -2
  24. package/build/AssetUris.d.ts.map +1 -0
  25. package/build/AssetUris.js +2 -2
  26. package/build/AssetUris.js.map +1 -1
  27. package/build/ImageAssets.d.ts +1 -0
  28. package/build/ImageAssets.d.ts.map +1 -0
  29. package/build/LocalAssets.d.ts +1 -0
  30. package/build/LocalAssets.d.ts.map +1 -0
  31. package/build/LocalAssets.web.d.ts +1 -0
  32. package/build/LocalAssets.web.d.ts.map +1 -0
  33. package/build/PlatformUtils.d.ts +3 -0
  34. package/build/PlatformUtils.d.ts.map +1 -0
  35. package/build/PlatformUtils.js +3 -0
  36. package/build/PlatformUtils.js.map +1 -1
  37. package/build/PlatformUtils.web.d.ts +2 -0
  38. package/build/PlatformUtils.web.d.ts.map +1 -0
  39. package/build/PlatformUtils.web.js +3 -0
  40. package/build/PlatformUtils.web.js.map +1 -1
  41. package/build/index.d.ts +1 -0
  42. package/build/index.d.ts.map +1 -0
  43. package/build/resolveAssetSource.d.ts +1 -0
  44. package/build/resolveAssetSource.d.ts.map +1 -0
  45. package/build/resolveAssetSource.web.d.ts +1 -0
  46. package/build/resolveAssetSource.web.d.ts.map +1 -0
  47. package/package.json +3 -3
  48. package/src/Asset.fx.ts +1 -1
  49. package/src/AssetSources.ts +15 -2
  50. package/src/AssetUris.ts +2 -2
  51. package/src/PlatformUtils.ts +5 -0
  52. package/src/PlatformUtils.web.ts +4 -0
package/CHANGELOG.md CHANGED
@@ -10,11 +10,29 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 8.5.0 — 2022-04-18
14
+
15
+ ### 💡 Others
16
+
17
+ - Swap out Cloudfront CDN for `classic-assets.eascdn.net`. ([#15781](https://github.com/expo/expo/pull/15781)) by [@quinlanj](https://github.com/quinlanj)
18
+
19
+ ## 8.4.6 - 2022-01-13
20
+
21
+ ### 🐛 Bug fixes
22
+
23
+ - Fix missing `getManifest2()` function on web. ([#15891](https://github.com/expo/expo/pull/15891)) by [@jonsamp](https://github.com/jonsamp) ([#15891](https://github.com/expo/expo/pull/15891) by [@jonsamp](https://github.com/jonsamp))
24
+
25
+ ## 8.4.5 — 2021-12-21
26
+
27
+ ### 🐛 Bug fixes
28
+
29
+ - Fix an issue preventing the loading of assets using expo-updates manifests during local development. ([#15667](https://github.com/expo/expo/pull/15667)) by [@jonsamp](https://github.com/jonsamp)
30
+
13
31
  ## 8.4.4 — 2021-11-17
14
32
 
15
33
  ### 🐛 Bug fixes
16
34
 
17
- - Fix `fromModule` on restrictive (Snack) web environments. ([#14435](https://github.com/expo/expo/pull/14435) by [@IjzerenHein](https://github.com/IjzerenHein))
35
+ - Fix `fromModule` on restrictive (Snack) web environments. ([#14435](https://github.com/expo/expo/pull/14435) by [@IjzerenHein](https://github.com/IjzerenHein))
18
36
 
19
37
  ## 8.4.1 — 2021-10-01
20
38
 
@@ -26,13 +44,13 @@
26
44
 
27
45
  ### 🎉 New features
28
46
 
29
- - Reapply [#12624](https://github.com/expo/expo/pull/12624) ([#13789](https://github.com/expo/expo/pull/13789) by [@jkhales](https://github.com/jkhales))
47
+ - Reapply [#12624](https://github.com/expo/expo/pull/12624) ([#13789](https://github.com/expo/expo/pull/13789) by [@jkhales](https://github.com/jkhales))
30
48
 
31
49
  ## 8.3.2 — 2021-04-21
32
50
 
33
51
  ### 🎉 New features
34
52
 
35
- - Find local assets without extensions. ([#12624](https://github.com/expo/expo/pull/12624) by [@jkhales](https://github.com/jkhales))
53
+ - Find local assets without extensions. ([#12624](https://github.com/expo/expo/pull/12624) by [@jkhales](https://github.com/jkhales))
36
54
 
37
55
  ## 8.3.1 — 2021-03-23
38
56
 
@@ -66,11 +84,11 @@ _This version does not introduce any user-facing changes._
66
84
 
67
85
  ## 8.1.7 — 2020-05-29
68
86
 
69
- *This version does not introduce any user-facing changes.*
87
+ _This version does not introduce any user-facing changes._
70
88
 
71
89
  ## 8.1.6 — 2020-05-27
72
90
 
73
- *This version does not introduce any user-facing changes.*
91
+ _This version does not introduce any user-facing changes._
74
92
 
75
93
  ## 8.1.5
76
94
 
package/README.md CHANGED
@@ -4,12 +4,12 @@ An Expo universal module to download assets and pass them into other APIs
4
4
 
5
5
  # API documentation
6
6
 
7
- - [Documentation for the master branch](https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/sdk/asset.md)
8
- - [Documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/asset/)
7
+ - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/asset.md)
8
+ - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/asset/)
9
9
 
10
10
  # Installation in managed Expo projects
11
11
 
12
- For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/asset/). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
12
+ For [managed](https://docs.expo.dev/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/asset/). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
13
13
 
14
14
  # Installation in bare React Native projects
15
15
 
package/build/Asset.d.ts CHANGED
@@ -97,3 +97,4 @@ export declare class Asset {
97
97
  */
98
98
  downloadAsync(): Promise<this>;
99
99
  }
100
+ //# sourceMappingURL=Asset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Asset.d.ts","sourceRoot":"","sources":["../src/Asset.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAqB,MAAM,gBAAgB,CAAC;AAQlE,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,aAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAChC,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC;AAGzB;;;GAGG;AACH,qBAAa,KAAK;IAChB;;OAEG;IACH,MAAM,CAAC,MAAM,KAAM;IACnB;;OAEG;IACH,MAAM,CAAC,KAAK,KAAM;IAElB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC3B;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC/B;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE7B,WAAW,EAAE,OAAO,CAAS;IAE7B,UAAU,EAAE,OAAO,CAAS;IAE5B;;OAEG;IACH,kBAAkB,EAAE,wBAAwB,EAAE,CAAM;gBAExC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAW,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,eAAe;IA+B5E;;;;;;;;;;OAUG;IACH,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAMnF;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK;IAwC7D,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,KAAK;IAsB/C,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK;IA2BlC;;;;;;;OAOG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAoCrC"}
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=Asset.fx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Asset.fx.d.ts","sourceRoot":"","sources":["../src/Asset.fx.ts"],"names":[],"mappings":""}
package/build/Asset.fx.js CHANGED
@@ -14,7 +14,7 @@ if (IS_ENV_WITH_UPDATES_ENABLED) {
14
14
  return resolver.defaultAsset();
15
15
  }
16
16
  }
17
- catch (e) {
17
+ catch {
18
18
  return resolver.defaultAsset();
19
19
  }
20
20
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Asset.fx.js","sourceRoot":"","sources":["../src/Asset.fx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,+FAA+F;AAC/F,IAAI,2BAA2B,EAAE;IAC/B,0BAA0B,CAAC,CAAC,QAAQ,EAAE,EAAE;QACtC,IAAI;YACF,2FAA2F;YAC3F,IAAI,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE;gBAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACjD,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,QAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aAC5E;iBAAM;gBACL,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC;aAChC;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC;SAChC;IACH,CAAC,CAAC,CAAC;CACJ","sourcesContent":["import { Asset } from './Asset';\nimport { IS_ENV_WITH_UPDATES_ENABLED } from './PlatformUtils';\nimport { setCustomSourceTransformer } from './resolveAssetSource';\n\n// Override React Native's asset resolution for `Image` components in contexts where it matters\nif (IS_ENV_WITH_UPDATES_ENABLED) {\n setCustomSourceTransformer((resolver) => {\n try {\n // Bundler is using the hashAssetFiles plugin if and only if the fileHashes property exists\n if (resolver.asset.fileHashes) {\n const asset = Asset.fromMetadata(resolver.asset);\n return resolver.fromSource(asset.downloaded ? asset.localUri! : asset.uri);\n } else {\n return resolver.defaultAsset();\n }\n } catch (e) {\n return resolver.defaultAsset();\n }\n });\n}\n"]}
1
+ {"version":3,"file":"Asset.fx.js","sourceRoot":"","sources":["../src/Asset.fx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,+FAA+F;AAC/F,IAAI,2BAA2B,EAAE;IAC/B,0BAA0B,CAAC,CAAC,QAAQ,EAAE,EAAE;QACtC,IAAI;YACF,2FAA2F;YAC3F,IAAI,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE;gBAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACjD,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,QAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aAC5E;iBAAM;gBACL,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC;aAChC;SACF;QAAC,MAAM;YACN,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC;SAChC;IACH,CAAC,CAAC,CAAC;CACJ","sourcesContent":["import { Asset } from './Asset';\nimport { IS_ENV_WITH_UPDATES_ENABLED } from './PlatformUtils';\nimport { setCustomSourceTransformer } from './resolveAssetSource';\n\n// Override React Native's asset resolution for `Image` components in contexts where it matters\nif (IS_ENV_WITH_UPDATES_ENABLED) {\n setCustomSourceTransformer((resolver) => {\n try {\n // Bundler is using the hashAssetFiles plugin if and only if the fileHashes property exists\n if (resolver.asset.fileHashes) {\n const asset = Asset.fromMetadata(resolver.asset);\n return resolver.fromSource(asset.downloaded ? asset.localUri! : asset.uri);\n } else {\n return resolver.defaultAsset();\n }\n } catch {\n return resolver.defaultAsset();\n }\n });\n}\n"]}
@@ -20,3 +20,4 @@ import { Asset } from './Asset';
20
20
  * ```
21
21
  */
22
22
  export declare function useAssets(moduleIds: number | number[]): [Asset[] | undefined, Error | undefined];
23
+ //# sourceMappingURL=AssetHooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetHooks.d.ts","sourceRoot":"","sources":["../src/AssetHooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAAC,CAShG"}
@@ -1 +1,2 @@
1
1
  export * from 'react-native/Libraries/Image/AssetRegistry';
2
+ //# sourceMappingURL=AssetRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetRegistry.d.ts","sourceRoot":"","sources":["../src/AssetRegistry.ts"],"names":[],"mappings":"AAAA,cAAc,4CAA4C,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from 'react-native-web/dist/modules/AssetRegistry';
2
+ //# sourceMappingURL=AssetRegistry.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetRegistry.web.d.ts","sourceRoot":"","sources":["../src/AssetRegistry.web.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import AssetSourceResolver from 'react-native/Libraries/Image/AssetSourceResolver';
2
2
  export default AssetSourceResolver;
3
3
  export * from 'react-native/Libraries/Image/AssetSourceResolver';
4
+ //# sourceMappingURL=AssetSourceResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetSourceResolver.d.ts","sourceRoot":"","sources":["../src/AssetSourceResolver.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,kDAAkD,CAAC;AACnF,eAAe,mBAAmB,CAAC;AACnC,cAAc,kDAAkD,CAAC"}
@@ -33,3 +33,4 @@ export default class AssetSourceResolver {
33
33
  static pickScale(scales: number[], deviceScale: number): number;
34
34
  }
35
35
  export {};
36
+ //# sourceMappingURL=AssetSourceResolver.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetSourceResolver.web.d.ts","sourceRoot":"","sources":["../src/AssetSourceResolver.web.ts"],"names":[],"mappings":"AAIA,aAAK,aAAa,GAAG;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AASF,oBAAY,mBAAmB,GAAG;IAChC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAaF,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACtC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,KAAK,EAAE,aAAa,CAAC;gBAGnB,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACpC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACtC,KAAK,EAAE,aAAa;IAMtB,kBAAkB,IAAI,OAAO;IAG7B,sBAAsB,IAAI,OAAO;IAGjC,YAAY,IAAI,mBAAmB;IAOnC,cAAc,IAAI,mBAAmB;IAWrC,eAAe,IAAI,mBAAmB;IAGtC,wBAAwB,IAAI,mBAAmB;IAI/C,8BAA8B,IAAI,mBAAmB;IAGrD,sBAAsB,IAAI,mBAAmB;IAG7C,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;IAU/C,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;CAQhE"}
@@ -27,3 +27,4 @@ export declare function selectAssetSource(meta: AssetMetadata): AssetSource;
27
27
  * base URI.
28
28
  */
29
29
  export declare function resolveUri(uri: string): string;
30
+ //# sourceMappingURL=AssetSources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetSources.d.ts","sourceRoot":"","sources":["../src/AssetSources.ts"],"names":[],"mappings":"AASA,oBAAY,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,oBAAY,WAAW,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAKF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,WAAW,CAiElE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAc9C"}
@@ -3,7 +3,7 @@ import path from 'path-browserify';
3
3
  import { PixelRatio } from 'react-native';
4
4
  import URL from 'url-parse';
5
5
  import AssetSourceResolver from './AssetSourceResolver';
6
- import { manifestBaseUrl, getManifest } from './PlatformUtils';
6
+ import { manifestBaseUrl, getManifest, getManifest2 } from './PlatformUtils';
7
7
  // Fast lookup check if asset map has any overrides in the manifest
8
8
  const assetMapOverride = getManifest().assetMapOverride;
9
9
  /**
@@ -42,6 +42,16 @@ export function selectAssetSource(meta) {
42
42
  const uri = meta.httpServerLocation + suffix;
43
43
  return { uri, hash };
44
44
  }
45
+ // For assets during development using manifest2, we use the development server's URL origin
46
+ const manifest2 = getManifest2();
47
+ if (manifest2?.extra?.expoGo?.developer) {
48
+ const baseUrl = new URL(`http://${manifest2.extra.expoGo.debuggerHost}`);
49
+ baseUrl.set('pathname', meta.httpServerLocation + suffix);
50
+ return {
51
+ uri: baseUrl.href,
52
+ hash,
53
+ };
54
+ }
45
55
  // For assets during development, we use the development server's URL origin
46
56
  if (getManifest().developer) {
47
57
  const baseUrl = new URL(getManifest().bundleUrl);
@@ -50,7 +60,7 @@ export function selectAssetSource(meta) {
50
60
  }
51
61
  // Production CDN URIs are based on each asset file hash
52
62
  return {
53
- uri: `https://d1wp6m56sqw74a.cloudfront.net/~assets/${encodeURIComponent(hash)}`,
63
+ uri: `https://classic-assets.eascdn.net/~assets/${encodeURIComponent(hash)}`,
54
64
  hash,
55
65
  };
56
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AssetSources.js","sourceRoot":"","sources":["../src/AssetSources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,GAAG,MAAM,WAAW,CAAC;AAE5B,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAqB/D,mEAAmE;AACnE,MAAM,gBAAgB,GAAG,WAAW,EAAE,CAAC,gBAAgB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAmB;IACnD,uDAAuD;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AClC,IAAI,QAAQ,KAAK,EAAE,EAAE;QACnB,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC;IACzC,MAAM,YAAY,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACtC,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC","sourcesContent":["import { Platform } from 'expo-modules-core';\nimport path from 'path-browserify';\nimport { PixelRatio } from 'react-native';\nimport URL from 'url-parse';\n\nimport AssetSourceResolver from './AssetSourceResolver';\nimport { manifestBaseUrl, getManifest } from './PlatformUtils';\n\n// @docsMissing\nexport type AssetMetadata = {\n hash: string;\n name: string;\n type: string;\n width?: number;\n height?: number;\n scales: number[];\n httpServerLocation: string;\n uri?: string;\n fileHashes?: string[];\n fileUris?: string[];\n};\n\nexport type AssetSource = {\n uri: string;\n hash: string;\n};\n\n// Fast lookup check if asset map has any overrides in the manifest\nconst assetMapOverride = getManifest().assetMapOverride;\n\n/**\n * Selects the best file for the given asset (ex: choosing the best scale for images) and returns\n * a { uri, hash } pair for the specific asset file.\n *\n * If the asset isn't an image with multiple scales, the first file is selected.\n */\nexport function selectAssetSource(meta: AssetMetadata): AssetSource {\n // Override with the asset map in manifest if available\n if (assetMapOverride && assetMapOverride.hasOwnProperty(meta.hash)) {\n meta = { ...meta, ...assetMapOverride[meta.hash] };\n }\n\n // This logic is based on that of AssetSourceResolver, with additional support for file hashes and\n // explicitly provided URIs\n const scale = AssetSourceResolver.pickScale(meta.scales, PixelRatio.get());\n const index = meta.scales.findIndex((s) => s === scale);\n const hash = meta.fileHashes ? meta.fileHashes[index] || meta.fileHashes[0] : meta.hash;\n\n // Allow asset processors to directly provide the URL to load\n const uri = meta.fileUris ? meta.fileUris[index] || meta.fileUris[0] : meta.uri;\n if (uri) {\n return { uri: resolveUri(uri), hash };\n }\n\n // Check if the assetUrl was overridden in the manifest\n const assetUrlOverride = getManifest().assetUrlOverride;\n if (assetUrlOverride) {\n const uri = path.join(assetUrlOverride, hash);\n return { uri: resolveUri(uri), hash };\n }\n\n const fileScale = scale === 1 ? '' : `@${scale}x`;\n const fileExtension = meta.type ? `.${encodeURIComponent(meta.type)}` : '';\n const suffix = `/${encodeURIComponent(\n meta.name\n )}${fileScale}${fileExtension}?platform=${encodeURIComponent(\n Platform.OS\n )}&hash=${encodeURIComponent(meta.hash)}`;\n\n // For assets with a specified absolute URL, we use the existing origin instead of prepending the\n // development server or production CDN URL origin\n if (/^https?:\\/\\//.test(meta.httpServerLocation)) {\n const uri = meta.httpServerLocation + suffix;\n return { uri, hash };\n }\n\n // For assets during development, we use the development server's URL origin\n if (getManifest().developer) {\n const baseUrl = new URL(getManifest().bundleUrl);\n baseUrl.set('pathname', meta.httpServerLocation + suffix);\n return { uri: baseUrl.href, hash };\n }\n\n // Production CDN URIs are based on each asset file hash\n return {\n uri: `https://d1wp6m56sqw74a.cloudfront.net/~assets/${encodeURIComponent(hash)}`,\n hash,\n };\n}\n\n/**\n * Resolves the given URI to an absolute URI. If the given URI is already an absolute URI, it is\n * simply returned. Otherwise, if it is a relative URI, it is resolved relative to the manifest's\n * base URI.\n */\nexport function resolveUri(uri: string): string {\n if (!manifestBaseUrl) {\n return uri;\n }\n\n const { protocol } = new URL(uri);\n if (protocol !== '') {\n return uri;\n }\n\n const baseUrl = new URL(manifestBaseUrl);\n const resolvedPath = uri.startsWith('/') ? uri : path.join(baseUrl.pathname, uri);\n baseUrl.set('pathname', resolvedPath);\n return baseUrl.href;\n}\n"]}
1
+ {"version":3,"file":"AssetSources.js","sourceRoot":"","sources":["../src/AssetSources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mB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path-browserify';\nimport { PixelRatio } from 'react-native';\nimport URL from 'url-parse';\n\nimport AssetSourceResolver from './AssetSourceResolver';\nimport { manifestBaseUrl, getManifest, getManifest2 } from './PlatformUtils';\n\n// @docsMissing\nexport type AssetMetadata = {\n hash: string;\n name: string;\n type: string;\n width?: number;\n height?: number;\n scales: number[];\n httpServerLocation: string;\n uri?: string;\n fileHashes?: string[];\n fileUris?: string[];\n};\n\nexport type AssetSource = {\n uri: string;\n hash: string;\n};\n\n// Fast lookup check if asset map has any overrides in the manifest\nconst assetMapOverride = getManifest().assetMapOverride;\n\n/**\n * Selects the best file for the given asset (ex: choosing the best scale for images) and returns\n * a { uri, hash } pair for the specific asset file.\n *\n * If the asset isn't an image with multiple scales, the first file is selected.\n */\nexport function selectAssetSource(meta: AssetMetadata): AssetSource {\n // Override with the asset map in manifest if available\n if (assetMapOverride && assetMapOverride.hasOwnProperty(meta.hash)) {\n meta = { ...meta, ...assetMapOverride[meta.hash] };\n }\n\n // This logic is based on that of AssetSourceResolver, with additional support for file hashes and\n // explicitly provided URIs\n const scale = AssetSourceResolver.pickScale(meta.scales, PixelRatio.get());\n const index = meta.scales.findIndex((s) => s === scale);\n const hash = meta.fileHashes ? meta.fileHashes[index] || meta.fileHashes[0] : meta.hash;\n\n // Allow asset processors to directly provide the URL to load\n const uri = meta.fileUris ? meta.fileUris[index] || meta.fileUris[0] : meta.uri;\n if (uri) {\n return { uri: resolveUri(uri), hash };\n }\n\n // Check if the assetUrl was overridden in the manifest\n const assetUrlOverride = getManifest().assetUrlOverride;\n if (assetUrlOverride) {\n const uri = path.join(assetUrlOverride, hash);\n return { uri: resolveUri(uri), hash };\n }\n\n const fileScale = scale === 1 ? '' : `@${scale}x`;\n const fileExtension = meta.type ? `.${encodeURIComponent(meta.type)}` : '';\n const suffix = `/${encodeURIComponent(\n meta.name\n )}${fileScale}${fileExtension}?platform=${encodeURIComponent(\n Platform.OS\n )}&hash=${encodeURIComponent(meta.hash)}`;\n\n // For assets with a specified absolute URL, we use the existing origin instead of prepending the\n // development server or production CDN URL origin\n if (/^https?:\\/\\//.test(meta.httpServerLocation)) {\n const uri = meta.httpServerLocation + suffix;\n return { uri, hash };\n }\n\n // For assets during development using manifest2, we use the development server's URL origin\n const manifest2 = getManifest2();\n\n if (manifest2?.extra?.expoGo?.developer) {\n const baseUrl = new URL(`http://${manifest2.extra.expoGo.debuggerHost}`);\n baseUrl.set('pathname', meta.httpServerLocation + suffix);\n\n return {\n uri: baseUrl.href,\n hash,\n };\n }\n\n // For assets during development, we use the development server's URL origin\n if (getManifest().developer) {\n const baseUrl = new URL(getManifest().bundleUrl);\n baseUrl.set('pathname', meta.httpServerLocation + suffix);\n return { uri: baseUrl.href, hash };\n }\n\n // Production CDN URIs are based on each asset file hash\n return {\n uri: `https://classic-assets.eascdn.net/~assets/${encodeURIComponent(hash)}`,\n hash,\n };\n}\n\n/**\n * Resolves the given URI to an absolute URI. If the given URI is already an absolute URI, it is\n * simply returned. Otherwise, if it is a relative URI, it is resolved relative to the manifest's\n * base URI.\n */\nexport function resolveUri(uri: string): string {\n if (!manifestBaseUrl) {\n return uri;\n }\n\n const { protocol } = new URL(uri);\n if (protocol !== '') {\n return uri;\n }\n\n const baseUrl = new URL(manifestBaseUrl);\n const resolvedPath = uri.startsWith('/') ? uri : path.join(baseUrl.pathname, uri);\n baseUrl.set('pathname', resolvedPath);\n return baseUrl.href;\n}\n"]}
@@ -5,10 +5,11 @@ export declare function getFileExtension(url: string): string;
5
5
  * https://example.com/app/manifest.json, the base URL would be https://example.com/app/. Query
6
6
  * parameters and fragments also are removed.
7
7
  *
8
- * For an Expo-hosted project with a manifest hosted at https://expo.io/@user/project/index.exp, the
9
- * base URL would be https://expo.io/@user/project.
8
+ * For an Expo-hosted project with a manifest hosted at https://exp.host/@user/project/index.exp, the
9
+ * base URL would be https://exp.host/@user/project.
10
10
  *
11
11
  * We also normalize the "exp" protocol to "http" to handle internal URLs with the Expo schemes used
12
12
  * to tell the OS to open the URLs in the the Expo client.
13
13
  */
14
14
  export declare function getManifestBaseUrl(manifestUrl: string): string;
15
+ //# sourceMappingURL=AssetUris.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetUris.d.ts","sourceRoot":"","sources":["../src/AssetUris.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAiB9D"}
@@ -14,8 +14,8 @@ export function getFileExtension(url) {
14
14
  * https://example.com/app/manifest.json, the base URL would be https://example.com/app/. Query
15
15
  * parameters and fragments also are removed.
16
16
  *
17
- * For an Expo-hosted project with a manifest hosted at https://expo.io/@user/project/index.exp, the
18
- * base URL would be https://expo.io/@user/project.
17
+ * For an Expo-hosted project with a manifest hosted at https://exp.host/@user/project/index.exp, the
18
+ * base URL would be https://exp.host/@user/project.
19
19
  *
20
20
  * We also normalize the "exp" protocol to "http" to handle internal URLs with the Expo schemes used
21
21
  * to tell the OS to open the URLs in the the Expo client.
@@ -1 +1 @@
1
- {"version":3,"file":"AssetUris.js","sourceRoot":"","sources":["../src/AssetUris.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,WAAW,CAAC;AAE5B,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACtC,OAAO,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC3C,uCAAuC;IACvC,OAAO,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACpD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAE3C,+CAA+C;IAC/C,IAAI,SAAS,CAAC,QAAQ,KAAK,MAAM,EAAE;QACjC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;KACpC;SAAM,IAAI,SAAS,CAAC,QAAQ,KAAK,OAAO,EAAE;QACzC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KACrC;IAED,wDAAwD;IACxD,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3F,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACrC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC3B,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAE1B,OAAO,SAAS,CAAC,IAAI,CAAC;AACxB,CAAC","sourcesContent":["import URL from 'url-parse';\n\nexport function getFilename(url: string): string {\n const { pathname } = new URL(url, {});\n return pathname.substring(pathname.lastIndexOf('/') + 1);\n}\n\nexport function getFileExtension(url: string): string {\n const filename = getFilename(url);\n const dotIndex = filename.lastIndexOf('.');\n // Ignore leading dots for hidden files\n return dotIndex > 0 ? filename.substring(dotIndex) : '';\n}\n\n/**\n * Returns the base URL from a manifest's URL. For example, given a manifest hosted at\n * https://example.com/app/manifest.json, the base URL would be https://example.com/app/. Query\n * parameters and fragments also are removed.\n *\n * For an Expo-hosted project with a manifest hosted at https://expo.io/@user/project/index.exp, the\n * base URL would be https://expo.io/@user/project.\n *\n * We also normalize the \"exp\" protocol to \"http\" to handle internal URLs with the Expo schemes used\n * to tell the OS to open the URLs in the the Expo client.\n */\nexport function getManifestBaseUrl(manifestUrl: string): string {\n const urlObject = new URL(manifestUrl, {});\n\n // Change the scheme to http(s) if it is exp(s)\n if (urlObject.protocol === 'exp:') {\n urlObject.set('protocol', 'http:');\n } else if (urlObject.protocol === 'exps:') {\n urlObject.set('protocol', 'https:');\n }\n\n // Trim filename, query parameters, and fragment, if any\n const directory = urlObject.pathname.substring(0, urlObject.pathname.lastIndexOf('/') + 1);\n urlObject.set('pathname', directory);\n urlObject.set('query', '');\n urlObject.set('hash', '');\n\n return urlObject.href;\n}\n"]}
1
+ {"version":3,"file":"AssetUris.js","sourceRoot":"","sources":["../src/AssetUris.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,WAAW,CAAC;AAE5B,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACtC,OAAO,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC3C,uCAAuC;IACvC,OAAO,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACpD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAE3C,+CAA+C;IAC/C,IAAI,SAAS,CAAC,QAAQ,KAAK,MAAM,EAAE;QACjC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;KACpC;SAAM,IAAI,SAAS,CAAC,QAAQ,KAAK,OAAO,EAAE;QACzC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KACrC;IAED,wDAAwD;IACxD,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3F,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACrC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC3B,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAE1B,OAAO,SAAS,CAAC,IAAI,CAAC;AACxB,CAAC","sourcesContent":["import URL from 'url-parse';\n\nexport function getFilename(url: string): string {\n const { pathname } = new URL(url, {});\n return pathname.substring(pathname.lastIndexOf('/') + 1);\n}\n\nexport function getFileExtension(url: string): string {\n const filename = getFilename(url);\n const dotIndex = filename.lastIndexOf('.');\n // Ignore leading dots for hidden files\n return dotIndex > 0 ? filename.substring(dotIndex) : '';\n}\n\n/**\n * Returns the base URL from a manifest's URL. For example, given a manifest hosted at\n * https://example.com/app/manifest.json, the base URL would be https://example.com/app/. Query\n * parameters and fragments also are removed.\n *\n * For an Expo-hosted project with a manifest hosted at https://exp.host/@user/project/index.exp, the\n * base URL would be https://exp.host/@user/project.\n *\n * We also normalize the \"exp\" protocol to \"http\" to handle internal URLs with the Expo schemes used\n * to tell the OS to open the URLs in the the Expo client.\n */\nexport function getManifestBaseUrl(manifestUrl: string): string {\n const urlObject = new URL(manifestUrl, {});\n\n // Change the scheme to http(s) if it is exp(s)\n if (urlObject.protocol === 'exp:') {\n urlObject.set('protocol', 'http:');\n } else if (urlObject.protocol === 'exps:') {\n urlObject.set('protocol', 'https:');\n }\n\n // Trim filename, query parameters, and fragment, if any\n const directory = urlObject.pathname.substring(0, urlObject.pathname.lastIndexOf('/') + 1);\n urlObject.set('pathname', directory);\n urlObject.set('query', '');\n urlObject.set('hash', '');\n\n return urlObject.href;\n}\n"]}
@@ -6,3 +6,4 @@ declare type ImageInfo = {
6
6
  export declare function isImageType(type: string): boolean;
7
7
  export declare function getImageInfoAsync(url: string): Promise<ImageInfo>;
8
8
  export {};
9
+ //# sourceMappingURL=ImageAssets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageAssets.d.ts","sourceRoot":"","sources":["../src/ImageAssets.ts"],"names":[],"mappings":"AAGA,aAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAajE"}
@@ -2,3 +2,4 @@
2
2
  * Returns the URI of a local asset from its hash, or null if the asset is not available locally
3
3
  */
4
4
  export declare function getLocalAssetUri(hash: string, type: string | null): string | null;
5
+ //# sourceMappingURL=LocalAssets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalAssets.d.ts","sourceRoot":"","sources":["../src/LocalAssets.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAwBjF"}
@@ -1 +1,2 @@
1
1
  export declare function getLocalAssetUri(hash: string, type: string | null): string | null;
2
+ //# sourceMappingURL=LocalAssets.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalAssets.web.d.ts","sourceRoot":"","sources":["../src/LocalAssets.web.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAGjF"}
@@ -1,3 +1,4 @@
1
+ import { Manifest } from 'expo-constants/build/Constants.types';
1
2
  export declare const IS_MANAGED_ENV: boolean;
2
3
  export declare const IS_BARE_ENV_WITH_UPDATES: boolean;
3
4
  export declare const IS_ENV_WITH_UPDATES_ENABLED: boolean;
@@ -6,5 +7,7 @@ export declare function getLocalAssets(): any;
6
7
  export declare function getManifest(): {
7
8
  [key: string]: any;
8
9
  };
10
+ export declare function getManifest2(): Manifest | undefined;
9
11
  export declare const manifestBaseUrl: string | null;
10
12
  export declare function downloadAsync(uri: any, hash: any, type: any, name: any): Promise<string>;
13
+ //# sourceMappingURL=PlatformUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformUtils.d.ts","sourceRoot":"","sources":["../src/PlatformUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAOhE,eAAO,MAAM,cAAc,SAA2B,CAAC;AAKvD,eAAO,MAAM,wBAAwB,SAKmB,CAAC;AAEzD,eAAO,MAAM,2BAA2B,SAA6C,CAAC;AAGtF,eAAO,MAAM,2BAA2B,SAA+C,CAAC;AAIxF,wBAAgB,cAAc,QAE7B;AAED,wBAAgB,WAAW,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAEpD;AAED,wBAAgB,YAAY,IAAI,QAAQ,GAAG,SAAS,CAEnD;AAGD,eAAO,MAAM,eAAe,eAEpB,CAAC;AAGT,wBAAsB,aAAa,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,IAAI,KAAA,GAAG,OAAO,CAAC,MAAM,CAAC,CAM1E"}
@@ -24,6 +24,9 @@ export function getLocalAssets() {
24
24
  export function getManifest() {
25
25
  return Constants.__unsafeNoWarnManifest ?? {};
26
26
  }
27
+ export function getManifest2() {
28
+ return Constants.__unsafeNoWarnManifest2;
29
+ }
27
30
  // Compute manifest base URL if available
28
31
  export const manifestBaseUrl = Constants.experienceUrl
29
32
  ? getManifestBaseUrl(Constants.experienceUrl)
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformUtils.js","sourceRoot":"","sources":["../src/PlatformUtils.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC;AAEvD,yFAAyF;AACzF,sFAAsF;AACtF,0BAA0B;AAC1B,MAAM,CAAC,MAAM,wBAAwB,GACnC,CAAC,cAAc;IACf,CAAC,CAAC,kBAAkB,CAAC,WAAW,EAAE,SAAS;IAC3C,kGAAkG;IAClG,sCAAsC;IACtC,CAAC,kBAAkB,CAAC,WAAW,EAAE,qBAAqB,CAAC;AAEzD,MAAM,CAAC,MAAM,2BAA2B,GAAG,cAAc,IAAI,wBAAwB,CAAC;AAEtF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,cAAc,IAAI,CAAC,wBAAwB,CAAC;AAExF,gFAAgF;AAChF,iEAAiE;AACjE,MAAM,UAAU,cAAc;IAC5B,OAAO,kB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GAAG,KAAK,IAAI,EAAE;YACjC,MAAM,IAAI,KAAK,CACb,8BAA8B,IAAI,IAAI,IAAI,IAAI;gBAC5C,cAAc,GAAG,GAAG;gBACpB,4BAA4B,CAC/B,CAAC;SACH;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,0BAA0B,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI;IACvD,uEAAuE;IACvE,0CAA0C;IAC1C,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC7B,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,WAAW,GAAG,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,GAAG,UAAU,CAAC,cAAc,iBAAiB,WAAW,IAAI,IAAI,EAAE,CAAC;IAEpF,4EAA4E;IAC5E,yCAAyC;IACzC,MAAM,UAAU,CAAC,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC9C,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import computeMd5 from 'blueimp-md5';\nimport Constants from 'expo-constants';\nimport * as FileSystem from 'expo-file-system';\nimport { NativeModulesProxy } from 'expo-modules-core';\n\nimport { getManifestBaseUrl } from './AssetUris';\n\n// Constants.appOwnership is only available in managed apps (Expo client and standalone)\nexport const IS_MANAGED_ENV = !!Constants.appOwnership;\n\n// In the future (SDK38+) expo-updates is likely to be used in managed apps, so we decide\n// that you are in a bare app with updates if you're not in a managed app and you have\n// local assets available.\nexport const IS_BARE_ENV_WITH_UPDATES =\n !IS_MANAGED_ENV &&\n !!NativeModulesProxy.ExpoUpdates?.isEnabled &&\n // if expo-updates is installed but we're running directly from the embedded bundle, we don't want\n // to override the AssetSourceResolver\n !NativeModulesProxy.ExpoUpdates?.isUsingEmbeddedAssets;\n\nexport const IS_ENV_WITH_UPDATES_ENABLED = IS_MANAGED_ENV || IS_BARE_ENV_WITH_UPDATES;\n\n// If it's not managed or bare w/ updates, then it must be bare w/o updates!\nexport const IS_BARE_ENV_WITHOUT_UPDATES = !IS_MANAGED_ENV && !IS_BARE_ENV_WITH_UPDATES;\n\n// Get the localAssets property from the ExpoUpdates native module so that we do\n// not need to include expo-updates as a dependency of expo-asset\nexport function getLocalAssets() {\n return NativeModulesProxy.ExpoUpdates?.localAssets ?? {};\n}\n\nexport function getManifest(): { [key: string]: any } {\n return Constants.__unsafeNoWarnManifest ?? {};\n}\n\n// Compute manifest base URL if available\nexport const manifestBaseUrl = Constants.experienceUrl\n ? getManifestBaseUrl(Constants.experienceUrl)\n : null;\n\n// TODO: how should this behave in bare app with updates? re: hashAssetFiles\nexport async function downloadAsync(uri, hash, type, name): Promise<string> {\n if (IS_MANAGED_ENV) {\n return _downloadAsyncManagedEnv(uri, hash, type, name);\n }\n\n return _downloadAsyncUnmanagedEnv(uri, hash, type);\n}\n\n/**\n * Check if the file exists on disk already, perform integrity check if so.\n * Otherwise, download it.\n */\nasync function _downloadAsyncManagedEnv(uri, hash, type, name): Promise<string> {\n const cacheFileId = hash || computeMd5(uri);\n const localUri = `${FileSystem.cacheDirectory}ExponentAsset-${cacheFileId}.${type}`;\n let { exists, md5 } = await FileSystem.getInfoAsync(localUri, {\n md5: true,\n });\n if (!exists || (hash !== null && md5 !== hash)) {\n ({ md5 } = await FileSystem.downloadAsync(uri, localUri, {\n md5: true,\n }));\n if (hash !== null && md5 !== hash) {\n throw new Error(\n `Downloaded file for asset '${name}.${type}' ` +\n `Located at ${uri} ` +\n `failed MD5 integrity check`\n );\n }\n }\n return localUri;\n}\n\n/**\n * Just download the asset, don't perform integrity check because we don't have\n * the hash to compare it with (we don't have hashAssetFiles plugin). Hash is\n * only used for the file name.\n */\nasync function _downloadAsyncUnmanagedEnv(uri, hash, type): Promise<string> {\n // TODO: does this make sense to bail out if it's already at a file URL\n // because it's already available locally?\n if (uri.startsWith('file://')) {\n return uri;\n }\n\n const cacheFileId = hash || computeMd5(uri);\n const localUri = `${FileSystem.cacheDirectory}ExponentAsset-${cacheFileId}.${type}`;\n\n // We don't check the FileSystem for an existing version of the asset and we\n // also don't perform an integrity check!\n await FileSystem.downloadAsync(uri, localUri);\n return localUri;\n}\n"]}
1
+ {"version":3,"file":"PlatformUtils.js","sourceRoot":"","sources":["../src/PlatformUtils.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC;AAEvD,yFAAyF;AACzF,sFAAsF;AACtF,0BAA0B;AAC1B,MAAM,CAAC,MAAM,wBAAwB,GACnC,CAAC,cAAc;IACf,CAAC,CAAC,kBAAkB,CAAC,WAAW,EAAE,SAAS;IAC3C,kGAAkG;IAClG,sCAAsC;IACtC,CAAC,kBAAkB,CAAC,WAAW,EAAE,qBAAqB,CAAC;AAEzD,MAAM,CAAC,MAAM,2BAA2B,GAAG,cAAc,IAAI,wBAAwB,CAAC;AAEtF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,cAAc,IAAI,CAAC,wBAAwB,CAAC;AAExF,gFAAgF;AAChF,iEAAiE;AACjE,MAAM,UAAU,cAAc;IAC5B,OAAO,kBAAkB,CAAC,WAAW,EAAE,WAAW,IAAI,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,SAAS,CAAC,sBAAsB,IAAI,EAAE,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,SAAS,CAAC,uBAAuB,CAAC;AAC3C,CAAC;AAED,yCAAyC;AACz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AQ,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,0BAA0B,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI;IACvD,uEAAuE;IACvE,0CAA0C;IAC1C,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC7B,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,WAAW,GAAG,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,GAAG,UAAU,CAAC,cAAc,iBAAiB,WAAW,IAAI,IAAI,EAAE,CAAC;IAEpF,4EAA4E;IAC5E,yCAAyC;IACzC,MAAM,UAAU,CAAC,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC9C,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import computeMd5 from 'blueimp-md5';\nimport Constants from 'expo-constants';\nimport { Manifest } from 'expo-constants/build/Constants.types';\nimport * as FileSystem from 'expo-file-system';\nimport { NativeModulesProxy } from 'expo-modules-core';\n\nimport { getManifestBaseUrl } from './AssetUris';\n\n// Constants.appOwnership is only available in managed apps (Expo client and standalone)\nexport const IS_MANAGED_ENV = !!Constants.appOwnership;\n\n// In the future (SDK38+) expo-updates is likely to be used in managed apps, so we decide\n// that you are in a bare app with updates if you're not in a managed app and you have\n// local assets available.\nexport const IS_BARE_ENV_WITH_UPDATES =\n !IS_MANAGED_ENV &&\n !!NativeModulesProxy.ExpoUpdates?.isEnabled &&\n // if expo-updates is installed but we're running directly from the embedded bundle, we don't want\n // to override the AssetSourceResolver\n !NativeModulesProxy.ExpoUpdates?.isUsingEmbeddedAssets;\n\nexport const IS_ENV_WITH_UPDATES_ENABLED = IS_MANAGED_ENV || IS_BARE_ENV_WITH_UPDATES;\n\n// If it's not managed or bare w/ updates, then it must be bare w/o updates!\nexport const IS_BARE_ENV_WITHOUT_UPDATES = !IS_MANAGED_ENV && !IS_BARE_ENV_WITH_UPDATES;\n\n// Get the localAssets property from the ExpoUpdates native module so that we do\n// not need to include expo-updates as a dependency of expo-asset\nexport function getLocalAssets() {\n return NativeModulesProxy.ExpoUpdates?.localAssets ?? {};\n}\n\nexport function getManifest(): { [key: string]: any } {\n return Constants.__unsafeNoWarnManifest ?? {};\n}\n\nexport function getManifest2(): Manifest | undefined {\n return Constants.__unsafeNoWarnManifest2;\n}\n\n// Compute manifest base URL if available\nexport const manifestBaseUrl = Constants.experienceUrl\n ? getManifestBaseUrl(Constants.experienceUrl)\n : null;\n\n// TODO: how should this behave in bare app with updates? re: hashAssetFiles\nexport async function downloadAsync(uri, hash, type, name): Promise<string> {\n if (IS_MANAGED_ENV) {\n return _downloadAsyncManagedEnv(uri, hash, type, name);\n }\n\n return _downloadAsyncUnmanagedEnv(uri, hash, type);\n}\n\n/**\n * Check if the file exists on disk already, perform integrity check if so.\n * Otherwise, download it.\n */\nasync function _downloadAsyncManagedEnv(uri, hash, type, name): Promise<string> {\n const cacheFileId = hash || computeMd5(uri);\n const localUri = `${FileSystem.cacheDirectory}ExponentAsset-${cacheFileId}.${type}`;\n let { exists, md5 } = await FileSystem.getInfoAsync(localUri, {\n md5: true,\n });\n if (!exists || (hash !== null && md5 !== hash)) {\n ({ md5 } = await FileSystem.downloadAsync(uri, localUri, {\n md5: true,\n }));\n if (hash !== null && md5 !== hash) {\n throw new Error(\n `Downloaded file for asset '${name}.${type}' ` +\n `Located at ${uri} ` +\n `failed MD5 integrity check`\n );\n }\n }\n return localUri;\n}\n\n/**\n * Just download the asset, don't perform integrity check because we don't have\n * the hash to compare it with (we don't have hashAssetFiles plugin). Hash is\n * only used for the file name.\n */\nasync function _downloadAsyncUnmanagedEnv(uri, hash, type): Promise<string> {\n // TODO: does this make sense to bail out if it's already at a file URL\n // because it's already available locally?\n if (uri.startsWith('file://')) {\n return uri;\n }\n\n const cacheFileId = hash || computeMd5(uri);\n const localUri = `${FileSystem.cacheDirectory}ExponentAsset-${cacheFileId}.${type}`;\n\n // We don't check the FileSystem for an existing version of the asset and we\n // also don't perform an integrity check!\n await FileSystem.downloadAsync(uri, localUri);\n return localUri;\n}\n"]}
@@ -4,3 +4,5 @@ export declare const IS_ENV_WITHOUT_UPDATES_ENABLED = false;
4
4
  export declare const manifestBaseUrl: null;
5
5
  export declare function downloadAsync(uri: any, hash: any, type: any, name: any): Promise<string>;
6
6
  export declare function getManifest(): {};
7
+ export declare function getManifest2(): {};
8
+ //# sourceMappingURL=PlatformUtils.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformUtils.web.d.ts","sourceRoot":"","sources":["../src/PlatformUtils.web.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,2BAA2B,QAAQ,CAAC;AACjD,eAAO,MAAM,8BAA8B,QAAQ,CAAC;AAGpD,eAAO,MAAM,eAAe,MAAO,CAAC;AAEpC,wBAAsB,aAAa,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,IAAI,KAAA,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1E;AAED,wBAAgB,WAAW,OAE1B;AAED,wBAAgB,YAAY,OAE3B"}
@@ -9,4 +9,7 @@ export async function downloadAsync(uri, hash, type, name) {
9
9
  export function getManifest() {
10
10
  return {};
11
11
  }
12
+ export function getManifest2() {
13
+ return {};
14
+ }
12
15
  //# sourceMappingURL=PlatformUtils.web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformUtils.web.js","sourceRoot":"","sources":["../src/PlatformUtils.web.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AACpC,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AACjD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,CAAC;AAEpD,yCAAyC;AACzC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACvD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["export const IS_MANAGED_ENV = false;\nexport const IS_ENV_WITH_UPDATES_ENABLED = false;\nexport const IS_ENV_WITHOUT_UPDATES_ENABLED = false;\n\n// Compute manifest base URL if available\nexport const manifestBaseUrl = null;\n\nexport async function downloadAsync(uri, hash, type, name): Promise<string> {\n return uri;\n}\n\nexport function getManifest() {\n return {};\n}\n"]}
1
+ {"version":3,"file":"PlatformUtils.web.js","sourceRoot":"","sources":["../src/PlatformUtils.web.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AACpC,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AACjD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,CAAC;AAEpD,yCAAyC;AACzC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACvD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["export const IS_MANAGED_ENV = false;\nexport const IS_ENV_WITH_UPDATES_ENABLED = false;\nexport const IS_ENV_WITHOUT_UPDATES_ENABLED = false;\n\n// Compute manifest base URL if available\nexport const manifestBaseUrl = null;\n\nexport async function downloadAsync(uri, hash, type, name): Promise<string> {\n return uri;\n}\n\nexport function getManifest() {\n return {};\n}\n\nexport function getManifest2() {\n return {};\n}\n"]}
package/build/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import './Asset.fx';
2
2
  export * from './Asset';
3
3
  export * from './AssetHooks';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AAEpB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
2
2
  export default resolveAssetSource;
3
3
  export * from 'react-native/Libraries/Image/resolveAssetSource';
4
+ //# sourceMappingURL=resolveAssetSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveAssetSource.d.ts","sourceRoot":"","sources":["../src/resolveAssetSource.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,iDAAiD,CAAC;AACjF,eAAe,kBAAkB,CAAC;AAClC,cAAc,iDAAiD,CAAC"}
@@ -6,3 +6,4 @@ export declare function setCustomSourceTransformer(transformer: (resolver: Asset
6
6
  */
7
7
  export default function resolveAssetSource(source: any): ResolvedAssetSource | undefined;
8
8
  export declare const pickScale: typeof AssetSourceResolver.pickScale;
9
+ //# sourceMappingURL=resolveAssetSource.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveAssetSource.web.d.ts","sourceRoot":"","sources":["../src/resolveAssetSource.web.ts"],"names":[],"mappings":"AAGA,OAAO,mBAAmB,EAAE,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAoCjF,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,mBAAmB,GAClE,IAAI,CAEN;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,mBAAmB,GAAG,SAAS,CAevF;AAQD,eAAO,MAAQ,SAAS,sCAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-asset",
3
- "version": "8.4.4",
3
+ "version": "8.5.0",
4
4
  "description": "An Expo universal module to download assets and pass them into other APIs",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -41,12 +41,12 @@
41
41
  "invariant": "^2.2.4",
42
42
  "md5-file": "^3.2.3",
43
43
  "path-browserify": "^1.0.0",
44
- "url-parse": "^1.4.4"
44
+ "url-parse": "^1.5.9"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@testing-library/react-hooks": "^7.0.1",
48
48
  "@types/url-parse": "^1.4.1",
49
49
  "expo-module-scripts": "^2.0.0"
50
50
  },
51
- "gitHead": "9faa58818454ba59dbff95077b9025a1c1cbd9fd"
51
+ "gitHead": "89a27c0ca0ca8becd7546697298e874a15e94faf"
52
52
  }
package/src/Asset.fx.ts CHANGED
@@ -13,7 +13,7 @@ if (IS_ENV_WITH_UPDATES_ENABLED) {
13
13
  } else {
14
14
  return resolver.defaultAsset();
15
15
  }
16
- } catch (e) {
16
+ } catch {
17
17
  return resolver.defaultAsset();
18
18
  }
19
19
  });
@@ -4,7 +4,7 @@ import { PixelRatio } from 'react-native';
4
4
  import URL from 'url-parse';
5
5
 
6
6
  import AssetSourceResolver from './AssetSourceResolver';
7
- import { manifestBaseUrl, getManifest } from './PlatformUtils';
7
+ import { manifestBaseUrl, getManifest, getManifest2 } from './PlatformUtils';
8
8
 
9
9
  // @docsMissing
10
10
  export type AssetMetadata = {
@@ -74,6 +74,19 @@ export function selectAssetSource(meta: AssetMetadata): AssetSource {
74
74
  return { uri, hash };
75
75
  }
76
76
 
77
+ // For assets during development using manifest2, we use the development server's URL origin
78
+ const manifest2 = getManifest2();
79
+
80
+ if (manifest2?.extra?.expoGo?.developer) {
81
+ const baseUrl = new URL(`http://${manifest2.extra.expoGo.debuggerHost}`);
82
+ baseUrl.set('pathname', meta.httpServerLocation + suffix);
83
+
84
+ return {
85
+ uri: baseUrl.href,
86
+ hash,
87
+ };
88
+ }
89
+
77
90
  // For assets during development, we use the development server's URL origin
78
91
  if (getManifest().developer) {
79
92
  const baseUrl = new URL(getManifest().bundleUrl);
@@ -83,7 +96,7 @@ export function selectAssetSource(meta: AssetMetadata): AssetSource {
83
96
 
84
97
  // Production CDN URIs are based on each asset file hash
85
98
  return {
86
- uri: `https://d1wp6m56sqw74a.cloudfront.net/~assets/${encodeURIComponent(hash)}`,
99
+ uri: `https://classic-assets.eascdn.net/~assets/${encodeURIComponent(hash)}`,
87
100
  hash,
88
101
  };
89
102
  }
package/src/AssetUris.ts CHANGED
@@ -17,8 +17,8 @@ export function getFileExtension(url: string): string {
17
17
  * https://example.com/app/manifest.json, the base URL would be https://example.com/app/. Query
18
18
  * parameters and fragments also are removed.
19
19
  *
20
- * For an Expo-hosted project with a manifest hosted at https://expo.io/@user/project/index.exp, the
21
- * base URL would be https://expo.io/@user/project.
20
+ * For an Expo-hosted project with a manifest hosted at https://exp.host/@user/project/index.exp, the
21
+ * base URL would be https://exp.host/@user/project.
22
22
  *
23
23
  * We also normalize the "exp" protocol to "http" to handle internal URLs with the Expo schemes used
24
24
  * to tell the OS to open the URLs in the the Expo client.
@@ -1,5 +1,6 @@
1
1
  import computeMd5 from 'blueimp-md5';
2
2
  import Constants from 'expo-constants';
3
+ import { Manifest } from 'expo-constants/build/Constants.types';
3
4
  import * as FileSystem from 'expo-file-system';
4
5
  import { NativeModulesProxy } from 'expo-modules-core';
5
6
 
@@ -33,6 +34,10 @@ export function getManifest(): { [key: string]: any } {
33
34
  return Constants.__unsafeNoWarnManifest ?? {};
34
35
  }
35
36
 
37
+ export function getManifest2(): Manifest | undefined {
38
+ return Constants.__unsafeNoWarnManifest2;
39
+ }
40
+
36
41
  // Compute manifest base URL if available
37
42
  export const manifestBaseUrl = Constants.experienceUrl
38
43
  ? getManifestBaseUrl(Constants.experienceUrl)
@@ -12,3 +12,7 @@ export async function downloadAsync(uri, hash, type, name): Promise<string> {
12
12
  export function getManifest() {
13
13
  return {};
14
14
  }
15
+
16
+ export function getManifest2() {
17
+ return {};
18
+ }