expo-asset 8.14.0 → 9.0.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 +14 -0
- package/build/AssetSources.js +7 -7
- package/build/AssetSources.js.map +1 -1
- package/build/LocalAssets.d.ts.map +1 -1
- package/build/LocalAssets.js +0 -13
- package/build/LocalAssets.js.map +1 -1
- package/package.json +5 -5
- package/src/AssetSources.ts +7 -7
- package/src/LocalAssets.ts +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,20 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 9.0.0 — 2023-12-12
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- Removed support for the Classic Updates service for SDK 50 ([announcement](https://blog.expo.dev/sunsetting-expo-publish-and-classic-updates-6cb9cd295378)). Specifically, references to the Classic Updates CDN were removed. [Migrate](https://docs.expo.dev/eas-update/migrate-from-classic-updates/) to EAS or other service that conforms to the modern [Expo Updates protocol](https://docs.expo.dev/technical-specs/expo-updates-1/). ([#25613](https://github.com/expo/expo/pull/25613) by [@ide](https://github.com/ide))
|
|
18
|
+
|
|
19
|
+
### 🎉 New features
|
|
20
|
+
|
|
21
|
+
- Added support for React Native 0.73.0. ([#24971](https://github.com/expo/expo/pull/24971), [#25453](https://github.com/expo/expo/pull/25453) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
22
|
+
|
|
23
|
+
### 💡 Others
|
|
24
|
+
|
|
25
|
+
- Removed references to legacy `bundledAssets` constant from `expo-file-system` that was used only in standalone apps. ([#25484](https://github.com/expo/expo/pull/25484) by [@tsapeta](https://github.com/tsapeta))
|
|
26
|
+
|
|
13
27
|
## 8.14.0 — 2023-11-14
|
|
14
28
|
|
|
15
29
|
### 🐛 Bug fixes
|
package/build/AssetSources.js
CHANGED
|
@@ -20,9 +20,9 @@ export function selectAssetSource(meta) {
|
|
|
20
20
|
// explicitly provided URIs
|
|
21
21
|
const scale = AssetSourceResolver.pickScale(meta.scales, PixelRatio.get());
|
|
22
22
|
const index = meta.scales.findIndex((s) => s === scale);
|
|
23
|
-
const hash = meta.fileHashes ? meta.fileHashes[index]
|
|
23
|
+
const hash = meta.fileHashes ? meta.fileHashes[index] ?? meta.fileHashes[0] : meta.hash;
|
|
24
24
|
// Allow asset processors to directly provide the URL to load
|
|
25
|
-
const uri = meta.fileUris ? meta.fileUris[index]
|
|
25
|
+
const uri = meta.fileUris ? meta.fileUris[index] ?? meta.fileUris[0] : meta.uri;
|
|
26
26
|
if (uri) {
|
|
27
27
|
return { uri: resolveUri(uri), hash };
|
|
28
28
|
}
|
|
@@ -62,11 +62,11 @@ export function selectAssetSource(meta) {
|
|
|
62
62
|
hash,
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
//
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
65
|
+
// In correctly configured apps, we arrive here if the asset is locally available on disk due to
|
|
66
|
+
// being managed by expo-updates, and `getLocalAssetUri(hash)` must return a local URI for this
|
|
67
|
+
// hash. Since the asset is local, we don't have a remote URL and specify an invalid URL (an empty
|
|
68
|
+
// string) as a placeholder.
|
|
69
|
+
return { uri: '', hash };
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Resolves the given URI to an absolute URI. If the given URI is already an absolute URI, it is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetSources.js","sourceRoot":"","sources":["../src/AssetSources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAiB7E,oEAAoE;AACpE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,gGAAgG;AAChG,MAAM,UAAU,QAAQ,CAAC,GAAG,KAAe;IACzC,sEAAsE;IACtE,MAAM,QAAQ,GAAG,KAAK;SACnB,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACnB,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,IAAI,CAAC,GAAG,CAAC;SACT,KAAK,CAAC,GAAG,CAAC,CAAC;IAEd,+BAA+B;IAC/B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE;QAC3B,IAAI,IAAI,KAAK,IAAI,EAAE;YACjB,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,0CAA0C;SAC3D;aAAM,IAAI,IAAI,KAAK,GAAG,EAAE;YACvB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;KACF;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import type { PackagerAsset } from '@react-native/assets-registry/registry';\nimport { Platform } from 'expo-modules-core';\nimport { PixelRatio } from 'react-native';\n\nimport AssetSourceResolver from './AssetSourceResolver';\nimport { getManifest, getManifest2, manifestBaseUrl } from './PlatformUtils';\n\n// @docsMissing\nexport type AssetMetadata = Pick<\n PackagerAsset,\n 'httpServerLocation' | 'name' | 'hash' | 'type' | 'scales' | 'width' | 'height'\n> & {\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.\n// This value will always be either null or an absolute URL, e.g. `https://expo.dev/`\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 = pathJoin(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(meta.name)}${fileScale}${fileExtension}`;\n const params = new URLSearchParams({\n platform: Platform.OS,\n hash: meta.hash,\n });\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 + '?' + params;\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 const devServerUrl = manifest2?.extra?.expoGo?.developer\n ? 'http://' + manifest2.extra.expoGo.debuggerHost\n : // For assets during development, we use the development server's URL origin\n getManifest().developer\n ? getManifest().bundleUrl\n : null;\n if (devServerUrl) {\n const baseUrl = new URL(meta.httpServerLocation + suffix, devServerUrl);\n\n baseUrl.searchParams.set('platform', Platform.OS);\n baseUrl.searchParams.set('hash', meta.hash);\n return {\n uri: baseUrl.href,\n hash,\n };\n }\n\n // In correctly configured apps, we arrive here if the asset is locally available on disk due to\n // being managed by expo-updates, and `getLocalAssetUri(hash)` must return a local URI for this\n // hash. Since the asset is local, we don't have a remote URL and specify an invalid URL (an empty\n // string) as a placeholder.\n return { uri: '', hash };\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 // `manifestBaseUrl` is always an absolute URL or `null`.\n return manifestBaseUrl ? new URL(uri, manifestBaseUrl).href : uri;\n}\n\n// A very cheap path canonicalization like path.join but without depending on a `path` polyfill.\nexport function pathJoin(...paths: string[]): string {\n // Start by simply combining paths, without worrying about \"..\" or \".\"\n const combined = paths\n .map((part, index) => {\n if (index === 0) {\n return part.trim().replace(/\\/*$/, '');\n }\n return part.trim().replace(/(^\\/*|\\/*$)/g, '');\n })\n .filter((part) => part.length > 0)\n .join('/')\n .split('/');\n\n // Handle \"..\" and \".\" in paths\n const resolved: string[] = [];\n for (const part of combined) {\n if (part === '..') {\n resolved.pop(); // Remove the last element from the result\n } else if (part !== '.') {\n resolved.push(part);\n }\n }\n\n return resolved.join('/');\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalAssets.d.ts","sourceRoot":"","sources":["../src/LocalAssets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocalAssets.d.ts","sourceRoot":"","sources":["../src/LocalAssets.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAejF"}
|
package/build/LocalAssets.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import Constants from 'expo-constants';
|
|
2
|
-
import * as FileSystem from 'expo-file-system';
|
|
3
1
|
import { getLocalAssets } from './PlatformUtils';
|
|
4
|
-
// Fast lookup check if assets are available in the local bundle in managed apps
|
|
5
|
-
const bundledAssets = new Set(FileSystem.bundledAssets || []);
|
|
6
2
|
// localAssets are provided by the expo-updates module
|
|
7
3
|
const localAssets = getLocalAssets();
|
|
8
4
|
/**
|
|
@@ -19,15 +15,6 @@ export function getLocalAssetUri(hash, type) {
|
|
|
19
15
|
// legacy updates store assets with an extension
|
|
20
16
|
return localAssets[legacyLocalAssetsKey];
|
|
21
17
|
}
|
|
22
|
-
case !__DEV__: {
|
|
23
|
-
// check legacy location in case we're in Expo client/managed workflow
|
|
24
|
-
// TODO(eric): remove this once bundledAssets is no longer exported from FileSystem
|
|
25
|
-
const assetName = `asset_${hash}${type ? `.${type}` : ''}`;
|
|
26
|
-
if (Constants.appOwnership !== 'standalone' || !bundledAssets.has(assetName)) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
return `${FileSystem.bundleDirectory}${assetName}`;
|
|
30
|
-
}
|
|
31
18
|
default:
|
|
32
19
|
return null;
|
|
33
20
|
}
|
package/build/LocalAssets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalAssets.js","sourceRoot":"","sources":["../src/LocalAssets.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"LocalAssets.js","sourceRoot":"","sources":["../src/LocalAssets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,sDAAsD;AACtD,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;AAErC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,IAAmB;IAChE,MAAM,cAAc,GAAG,IAAI,CAAC;IAC5B,MAAM,oBAAoB,GAAG,GAAG,IAAI,IAAI,IAAI,IAAI,EAAE,EAAE,CAAC;IAErD,QAAQ,IAAI,EAAE;QACZ,KAAK,cAAc,IAAI,WAAW,CAAC,CAAC;YAClC,OAAO,WAAW,CAAC,cAAc,CAAC,CAAC;SACpC;QACD,KAAK,oBAAoB,IAAI,WAAW,CAAC,CAAC;YACxC,gDAAgD;YAChD,OAAO,WAAW,CAAC,oBAAoB,CAAC,CAAC;SAC1C;QACD;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC","sourcesContent":["import { getLocalAssets } from './PlatformUtils';\n\n// localAssets are provided by the expo-updates module\nconst localAssets = getLocalAssets();\n\n/**\n * Returns the URI of a local asset from its hash, or null if the asset is not available locally\n */\nexport function getLocalAssetUri(hash: string, type: string | null): string | null {\n const localAssetsKey = hash;\n const legacyLocalAssetsKey = `${hash}.${type ?? ''}`;\n\n switch (true) {\n case localAssetsKey in localAssets: {\n return localAssets[localAssetsKey];\n }\n case legacyLocalAssetsKey in localAssets: {\n // legacy updates store assets with an extension\n return localAssets[legacyLocalAssetsKey];\n }\n default:\n return null;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-asset",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.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",
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
"preset": "expo-module-scripts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@react-native/assets-registry": "~0.
|
|
40
|
+
"@react-native/assets-registry": "~0.73.1",
|
|
41
41
|
"blueimp-md5": "^2.10.0",
|
|
42
42
|
"invariant": "^2.2.4",
|
|
43
43
|
"md5-file": "^3.2.3",
|
|
44
|
-
"expo-constants": "~15.
|
|
45
|
-
"expo-file-system": "~
|
|
44
|
+
"expo-constants": "~15.4.0",
|
|
45
|
+
"expo-file-system": "~16.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@testing-library/react-hooks": "^7.0.1",
|
|
49
49
|
"@types/react-native__assets": "~1.0.0",
|
|
50
50
|
"expo-module-scripts": "^3.0.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "6aca7ce098ddc667776a3d7cf612adbb985e264a"
|
|
53
53
|
}
|
package/src/AssetSources.ts
CHANGED
|
@@ -40,10 +40,10 @@ export function selectAssetSource(meta: AssetMetadata): AssetSource {
|
|
|
40
40
|
// explicitly provided URIs
|
|
41
41
|
const scale = AssetSourceResolver.pickScale(meta.scales, PixelRatio.get());
|
|
42
42
|
const index = meta.scales.findIndex((s) => s === scale);
|
|
43
|
-
const hash = meta.fileHashes ? meta.fileHashes[index]
|
|
43
|
+
const hash = meta.fileHashes ? meta.fileHashes[index] ?? meta.fileHashes[0] : meta.hash;
|
|
44
44
|
|
|
45
45
|
// Allow asset processors to directly provide the URL to load
|
|
46
|
-
const uri = meta.fileUris ? meta.fileUris[index]
|
|
46
|
+
const uri = meta.fileUris ? meta.fileUris[index] ?? meta.fileUris[0] : meta.uri;
|
|
47
47
|
if (uri) {
|
|
48
48
|
return { uri: resolveUri(uri), hash };
|
|
49
49
|
}
|
|
@@ -90,11 +90,11 @@ export function selectAssetSource(meta: AssetMetadata): AssetSource {
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
//
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
93
|
+
// In correctly configured apps, we arrive here if the asset is locally available on disk due to
|
|
94
|
+
// being managed by expo-updates, and `getLocalAssetUri(hash)` must return a local URI for this
|
|
95
|
+
// hash. Since the asset is local, we don't have a remote URL and specify an invalid URL (an empty
|
|
96
|
+
// string) as a placeholder.
|
|
97
|
+
return { uri: '', hash };
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
package/src/LocalAssets.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import Constants from 'expo-constants';
|
|
2
|
-
import * as FileSystem from 'expo-file-system';
|
|
3
|
-
|
|
4
1
|
import { getLocalAssets } from './PlatformUtils';
|
|
5
2
|
|
|
6
|
-
// Fast lookup check if assets are available in the local bundle in managed apps
|
|
7
|
-
const bundledAssets = new Set(FileSystem.bundledAssets || []);
|
|
8
|
-
|
|
9
3
|
// localAssets are provided by the expo-updates module
|
|
10
4
|
const localAssets = getLocalAssets();
|
|
11
5
|
|
|
@@ -24,15 +18,6 @@ export function getLocalAssetUri(hash: string, type: string | null): string | nu
|
|
|
24
18
|
// legacy updates store assets with an extension
|
|
25
19
|
return localAssets[legacyLocalAssetsKey];
|
|
26
20
|
}
|
|
27
|
-
case !__DEV__: {
|
|
28
|
-
// check legacy location in case we're in Expo client/managed workflow
|
|
29
|
-
// TODO(eric): remove this once bundledAssets is no longer exported from FileSystem
|
|
30
|
-
const assetName = `asset_${hash}${type ? `.${type}` : ''}`;
|
|
31
|
-
if (Constants.appOwnership !== 'standalone' || !bundledAssets.has(assetName)) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return `${FileSystem.bundleDirectory}${assetName}`;
|
|
35
|
-
}
|
|
36
21
|
default:
|
|
37
22
|
return null;
|
|
38
23
|
}
|