expo-asset 8.11.0 → 8.12.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.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 8.12.0 — 2023-09-04
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Convert `../` to `_` for the property `httpServerLocation` in `hashAssetFiles` (Metro asset pre-processor) to support assets in monorepos the same everywhere. ([#24090](https://github.com/expo/expo/pull/24090) by [@EvanBacon](https://github.com/EvanBacon))
18
+
13
19
  ## 8.11.0 — 2023-08-02
14
20
 
15
21
  _This version does not introduce any user-facing changes._
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-asset",
3
- "version": "8.11.0",
3
+ "version": "8.12.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",
@@ -42,8 +42,8 @@
42
42
  "md5-file": "^3.2.3",
43
43
  "path-browserify": "^1.0.0",
44
44
  "url-parse": "^1.5.9",
45
- "expo-constants": "~14.5.0",
46
- "expo-file-system": "~15.5.0"
45
+ "expo-constants": "~15.0.0",
46
+ "expo-file-system": "~15.6.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@testing-library/react-hooks": "^7.0.1",
@@ -51,5 +51,5 @@
51
51
  "@types/url-parse": "^1.4.1",
52
52
  "expo-module-scripts": "^3.0.0"
53
53
  },
54
- "gitHead": "2240630a92eb79a4e4bf73e1439916c394876478"
54
+ "gitHead": "79607a7325f47aa17c36d266100d09a4ff2cc544"
55
55
  }
@@ -1,8 +1,8 @@
1
1
  declare module 'path-browserify' {
2
- interface path {
3
- static join(...paths: string[]): string;
2
+ interface Path {
3
+ join(...paths: string[]): string;
4
4
  }
5
5
 
6
- const path: path;
6
+ const path: Path;
7
7
  export = path;
8
8
  }
@@ -3,8 +3,18 @@
3
3
  const md5File = require('md5-file/promise');
4
4
 
5
5
  module.exports = function hashAssetFiles(asset) {
6
- return Promise.all(asset.files.map(md5File)).then(hashes => {
6
+ return Promise.all(asset.files.map(md5File)).then((hashes) => {
7
7
  asset.fileHashes = hashes;
8
+
9
+ // Convert the `../` segments of the server URL to `_` to support monorepos.
10
+ // This same transformation takes place in `AssetSourceResolver.web` (expo-assets, expo-image) and `persistMetroAssets` of Expo CLI,
11
+ // this originally came from the Metro opinion https://github.com/react-native-community/cli/blob/2204d357379e2067cebe2791e90388f7e97fc5f5/packages/cli-plugin-metro/src/commands/bundle/getAssetDestPathIOS.ts#L19C5-L19C10
12
+ if (asset.httpServerLocation.includes('?export_path=')) {
13
+ asset.httpServerLocation = asset.httpServerLocation
14
+ .match(/\?export_path=(.*)/)[1]
15
+ .replace(/\.\.\//g, '_');
16
+ }
17
+
8
18
  return asset;
9
19
  });
10
20
  };