expo-asset 58.0.15 → 58.0.16
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 +6 -0
- package/android/build.gradle +2 -2
- package/build/Asset.d.ts +7 -6
- package/build/Asset.js +16 -13
- package/build/Asset.js.map +1 -1
- package/build/AssetSourceResolver.d.ts +1 -1
- package/build/AssetSourceResolver.js.map +1 -1
- package/build/AssetSources.d.ts +1 -1
- package/build/AssetSources.js.map +1 -1
- package/build/index.js +0 -1
- package/build/index.js.map +1 -1
- package/build/resolveAssetSource.js +2 -2
- package/build/resolveAssetSource.js.map +1 -1
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15.module → 58.0.16/expo.modules.asset-58.0.16.module} +7 -7
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.16/expo.modules.asset-58.0.16.module.md5 +1 -0
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.16/expo.modules.asset-58.0.16.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.16/expo.modules.asset-58.0.16.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.16/expo.modules.asset-58.0.16.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15.pom → 58.0.16/expo.modules.asset-58.0.16.pom} +1 -1
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.16/expo.modules.asset-58.0.16.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.16/expo.modules.asset-58.0.16.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.16/expo.modules.asset-58.0.16.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.16/expo.modules.asset-58.0.16.pom.sha512 +1 -0
- package/package.json +2 -2
- package/src/Asset.ts +29 -19
- package/src/AssetSourceResolver.ts +1 -2
- package/src/AssetSources.ts +1 -2
- package/src/index.ts +0 -2
- package/src/resolveAssetSource.ts +2 -2
- package/build/ts-declarations/react-native-assets.d.ts +0 -28
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.15/expo.modules.asset-58.0.15.module.md5 +0 -1
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.15/expo.modules.asset-58.0.15.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.15/expo.modules.asset-58.0.15.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.15/expo.modules.asset-58.0.15.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.15/expo.modules.asset-58.0.15.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.15/expo.modules.asset-58.0.15.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.15/expo.modules.asset-58.0.15.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/asset/expo.modules.asset/58.0.15/expo.modules.asset-58.0.15.pom.sha512 +0 -1
- package/src/ts-declarations/react-native-assets.d.ts +0 -28
- /package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15-sources.jar → 58.0.16/expo.modules.asset-58.0.16-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15-sources.jar.md5 → 58.0.16/expo.modules.asset-58.0.16-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15-sources.jar.sha1 → 58.0.16/expo.modules.asset-58.0.16-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15-sources.jar.sha256 → 58.0.16/expo.modules.asset-58.0.16-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15-sources.jar.sha512 → 58.0.16/expo.modules.asset-58.0.16-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15.aar → 58.0.16/expo.modules.asset-58.0.16.aar} +0 -0
- /package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15.aar.md5 → 58.0.16/expo.modules.asset-58.0.16.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15.aar.sha1 → 58.0.16/expo.modules.asset-58.0.16.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15.aar.sha256 → 58.0.16/expo.modules.asset-58.0.16.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/asset/expo.modules.asset/{58.0.15/expo.modules.asset-58.0.15.aar.sha512 → 58.0.16/expo.modules.asset-58.0.16.aar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
package/android/build.gradle
CHANGED
package/build/Asset.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ export type AssetDescriptor = {
|
|
|
7
7
|
width?: number | null;
|
|
8
8
|
height?: number | null;
|
|
9
9
|
};
|
|
10
|
+
interface VirtualAssetModule {
|
|
11
|
+
uri: string;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
10
15
|
export type { AssetMetadata } from './AssetSources';
|
|
11
16
|
/**
|
|
12
17
|
* Android resource URL prefix.
|
|
@@ -77,15 +82,11 @@ export declare class Asset {
|
|
|
77
82
|
static loadAsync(moduleId: number | number[] | string | string[]): Promise<Asset[]>;
|
|
78
83
|
/**
|
|
79
84
|
* Returns the [`Asset`](#asset) instance representing an asset given its module or URL.
|
|
80
|
-
* @param
|
|
85
|
+
* @param assetModule The value of `require('path/to/file')` for the asset or external
|
|
81
86
|
* network URL
|
|
82
87
|
* @return The [`Asset`](#asset) instance for the asset.
|
|
83
88
|
*/
|
|
84
|
-
static fromModule(
|
|
85
|
-
uri: string;
|
|
86
|
-
width: number;
|
|
87
|
-
height: number;
|
|
88
|
-
}): Asset;
|
|
89
|
+
static fromModule(assetModule: number | string | VirtualAssetModule): Asset;
|
|
89
90
|
static fromMetadata(meta: AssetMetadata): Asset;
|
|
90
91
|
static fromURI(uri: string): Asset;
|
|
91
92
|
/**
|
package/build/Asset.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform } from 'expo-modules-core';
|
|
2
|
-
import {
|
|
2
|
+
import { AssetRegistry } from 'react-native';
|
|
3
3
|
import { selectAssetSource } from './AssetSources';
|
|
4
4
|
import * as AssetUris from './AssetUris';
|
|
5
5
|
import { downloadAsync } from './ExpoAsset';
|
|
@@ -7,6 +7,9 @@ import * as ImageAssets from './ImageAssets';
|
|
|
7
7
|
import { getLocalAssetUri } from './LocalAssets';
|
|
8
8
|
import { IS_ENV_WITH_LOCAL_ASSETS } from './PlatformUtils';
|
|
9
9
|
import resolveAssetSource from './resolveAssetSource';
|
|
10
|
+
function isVirtualAsset(assetModule) {
|
|
11
|
+
return !!assetModule && typeof assetModule === 'object' && 'uri' in assetModule && typeof assetModule.uri === 'string';
|
|
12
|
+
}
|
|
10
13
|
/**
|
|
11
14
|
* Android resource URL prefix.
|
|
12
15
|
* @hidden
|
|
@@ -101,33 +104,33 @@ import resolveAssetSource from './resolveAssetSource';
|
|
|
101
104
|
// @needsAudit
|
|
102
105
|
/**
|
|
103
106
|
* Returns the [`Asset`](#asset) instance representing an asset given its module or URL.
|
|
104
|
-
* @param
|
|
107
|
+
* @param assetModule The value of `require('path/to/file')` for the asset or external
|
|
105
108
|
* network URL
|
|
106
109
|
* @return The [`Asset`](#asset) instance for the asset.
|
|
107
|
-
*/ static fromModule(
|
|
108
|
-
if (typeof
|
|
109
|
-
return Asset.fromURI(
|
|
110
|
+
*/ static fromModule(assetModule) {
|
|
111
|
+
if (typeof assetModule === 'string') {
|
|
112
|
+
return Asset.fromURI(assetModule);
|
|
110
113
|
}
|
|
111
|
-
if (
|
|
112
|
-
const extension = AssetUris.getFileExtension(
|
|
114
|
+
if (isVirtualAsset(assetModule)) {
|
|
115
|
+
const extension = AssetUris.getFileExtension(assetModule.uri);
|
|
113
116
|
return new Asset({
|
|
114
117
|
name: '',
|
|
115
118
|
type: extension.startsWith('.') ? extension.substring(1) : extension,
|
|
116
119
|
hash: null,
|
|
117
|
-
uri:
|
|
118
|
-
width:
|
|
119
|
-
height:
|
|
120
|
+
uri: assetModule.uri,
|
|
121
|
+
width: assetModule.width,
|
|
122
|
+
height: assetModule.height
|
|
120
123
|
});
|
|
121
124
|
}
|
|
122
|
-
const meta = getAssetByID(
|
|
125
|
+
const meta = AssetRegistry.getAssetByID(assetModule);
|
|
123
126
|
if (!meta) {
|
|
124
|
-
throw new Error(`Module "${
|
|
127
|
+
throw new Error(`Module "${assetModule}" is missing from the asset registry`);
|
|
125
128
|
}
|
|
126
129
|
// Outside of the managed env we need the moduleId to initialize the asset
|
|
127
130
|
// because resolveAssetSource depends on it
|
|
128
131
|
if (!IS_ENV_WITH_LOCAL_ASSETS) {
|
|
129
132
|
// null-check is performed above with `getAssetByID`.
|
|
130
|
-
const { uri } = resolveAssetSource(
|
|
133
|
+
const { uri } = resolveAssetSource(assetModule);
|
|
131
134
|
const asset = new Asset({
|
|
132
135
|
name: meta.name,
|
|
133
136
|
type: meta.type,
|
package/build/Asset.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Asset.ts"],"sourcesContent":[null],"names":["Platform","
|
|
1
|
+
{"version":3,"sources":["Asset.ts"],"sourcesContent":[null],"names":["Platform","AssetRegistry","selectAssetSource","AssetUris","downloadAsync","ImageAssets","getLocalAssetUri","IS_ENV_WITH_LOCAL_ASSETS","resolveAssetSource","isVirtualAsset","assetModule","uri","ANDROID_EMBEDDED_URL_BASE_RESOURCE","Asset","byHash","byUri","name","type","hash","localUri","width","height","downloading","downloaded","_downloadCallbacks","startsWith","OS","getFilename","getFileExtension","loadAsync","moduleId","moduleIds","Array","isArray","Promise","all","map","fromModule","fromURI","extension","substring","meta","getAssetByID","Error","asset","includes","fromMetadata","metaHash","assetByHash","indexOf","split","resolve","reject","push","isImageType","getImageInfoAsync","forEach","e"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,eAAe;AAE7C,SAA6BC,iBAAiB,QAAQ,iBAAiB;AACvE,YAAYC,eAAe,cAAc;AACzC,SAASC,aAAa,QAAQ,cAAc;AAC5C,YAAYC,iBAAiB,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,wBAAwB,QAAQ,kBAAkB;AAC3D,OAAOC,wBAAwB,uBAAuB;AAwBtD,SAASC,eAAeC,WAAoB;IAC1C,OACE,CAAC,CAACA,eACF,OAAOA,gBAAgB,YACvB,SAASA,eACT,OAAOA,YAAYC,GAAG,KAAK;AAE/B;AAIA;;;CAGC,GACD,OAAO,MAAMC,qCAAqC,uBAAuB;AAEzE;;;CAGC,GACD,OAAO,MAAMC;IACX,OAAeC,SAA4C,CAAC,EAAE;IAC9D,OAAeC,QAA2C,CAAC,EAAE;IAE7D;;;GAGC,GACD,AAAOC,KAAa;IACpB;;GAEC,GACD,AAAgBC,KAAa;IAC7B;;GAEC,GACD,AAAgBC,OAAsB,KAAK;IAC3C;;;;;;;GAOC,GACD,AAAgBP,IAAY;IAC5B;;;GAGC,GACD,AAAOQ,WAA0B,KAAK;IACtC;;;GAGC,GACD,AAAOC,QAAuB,KAAK;IACnC;;GAEC,GACD,AAAOC,SAAwB,KAAK;IAE5BC,cAAuB,MAAM;IAErC;;GAEC,GACD,AAAOC,aAAsB,MAAM;IAE3BC,qBAAiD,EAAE,CAAC;IAE5D,YAAY,EAAER,IAAI,EA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5B,kBAAkB,CAAC6B,IAAI,CAAC;oBAAEF;oBAASC;gBAAO;YACjD;YACA,OAAO,IAAI;QACb;QACA,IAAI,CAAC9B,WAAW,GAAG;QAEnB,IAAI;YACF,IAAItB,SAAS0B,EAAE,KAAK,OAAO;gBACzB,IAAIrB,YAAYiD,WAAW,CAAC,IAAI,CAACrC,IAAI,GAAG;oBACtC,MAAM,EAAEG,KAAK,EAAEC,MAAM,EAAEL,IAAI,EAAE,GAAG,MAAMX,YAAYkD,iBAAiB,CAAC,IAAI,CAAC5C,GAAG;oBAC5E,IAAI,CAACS,KAAK,GAAGA;oBACb,IAAI,CAACC,MAAM,GAAGA;oBACd,IAAI,CAACL,IAAI,GAAGA;gBACd,OAAO;oBACL,IAAI,CAACA,IAAI,GAAGb,UAAUwB,WAAW,CAAC,IAAI,CAAChB,GAAG;gBAC5C;YACF;YACA,IAAI,CAACQ,QAAQ,GAAG,MAAMf,cAAc,IAAI,CAACO,GAAG,EAAE,IAAI,CAACO,IAAI,EAAE,IAAI,CAACD,IAAI;YAElE,IAAI,CAACM,UAAU,GAAG;YAClB,IAAI,CAACC,kBAAkB,CAACgC,OAAO,CAAC,CAAC,EAAEL,OAAO,EAAE,GAAKA;QACnD,EAAE,OAAOM,GAAQ;YACf,IAAI,CAACjC,kBAAkB,CAACgC,OAAO,CAAC,CAAC,EAAEJ,MAAM,EAAE,GAAKA,OAAOK;YACvD,MAAMA;QACR,SAAU;YACR,IAAI,CAACnC,WAAW,GAAG;YACnB,IAAI,CAACE,kBAAkB,GAAG,EAAE;QAC9B;QACA,OAAO,IAAI;IACb;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["AssetSourceResolver.ts"],"sourcesContent":[null],"names":["Platform","PixelRatio","getScaledAssetPath","asset","scale","AssetSourceResolver","pickScale","scales","get","scaleSuffix","type","__DEV__","httpServerLocation","name","replace","serverUrl","jsbundleUrl","isLoadedFromServer","isLoadedFromFileSystem","defaultAsset","assetServerURL","fromUrl","URL","searchParams","set","OS","hash","fromSource","toString","origin","source","__packager_asset","width","undefined","height","uri","deviceScale","length"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,UAAU,
|
|
1
|
+
{"version":3,"sources":["AssetSourceResolver.ts"],"sourcesContent":[null],"names":["Platform","PixelRatio","getScaledAssetPath","asset","scale","AssetSourceResolver","pickScale","scales","get","scaleSuffix","type","__DEV__","httpServerLocation","name","replace","serverUrl","jsbundleUrl","isLoadedFromServer","isLoadedFromFileSystem","defaultAsset","assetServerURL","fromUrl","URL","searchParams","set","OS","hash","fromSource","toString","origin","source","__packager_asset","width","undefined","height","uri","deviceScale","length"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,UAAU,QAA4B,eAAe;AAY9D,wDAAwD;AACxD,SAASC,mBAAmBC,KAAoC;IAC9D,MAAMC,QAAQC,oBAAoBC,SAAS,CAACH,MAAMI,MAAM,EAAEN,WAAWO,GAAG;IACxE,MAAMC,cAAcL,UAAU,IAAI,KAAK,MAAMA,QAAQ;IACrD,MAAMM,OAAO,CAACP,MAAMO,IAAI,GAAG,KAAK,CAAC,CAAC,EAAEP,MAAMO,IAAI,EAAE;IAChD,IAAIC,SAAS;QACX,OAAOR,MAAMS,kBAAkB,GAAG,MAAMT,MAAMU,IAAI,GAAGJ,cAAcC;IACrE,OAAO;QACL,OAAOP,MAAMS,kBAAkB,CAACE,OAAO,CAAC,WAAW,OAAO,MAAMX,MAAMU,IAAI,GAAGJ,cAAcC;IAC7F;AACF;AAEA,eAAe,MAAML;IACFU,UAAkB;IACnC,uCAAuC;IACvC,yCAAyC;IACzC,uCAAuC;IACtBC,YAAuC;IACxD,uBAAuB;IACPb,MAAqC;IAErD,YACEY,SAAoC,EACpCC,WAAsC,EACtCb,KAAoB,CACpB;QACA,IAAI,CAACY,SAAS,GAAGA,aAAa;QAC9B,IAAI,CAACC,WAAW,GAAG;QACnB,IAAI,CAACb,KAAK,GAAGA;IACf;IAEA,+BAA+B;IAC/Bc,qBAA8B;QAC5B,OAAO;IACT;IAEA,gCAAgC;IAChCC,yBAAkC;QAChC,OAAO;IACT;IAEAC,eAAoC;QAClC,OAAO,IAAI,CAACC,cAAc;IAC5B;IAEA;;GAEC,GACDA,iBAAsC;QACpC,MAAMC,UAAU,IAAIC,IAAIpB,mBAAmB,IAAI,CAACC,KAAK,GAAG,IAAI,CAACY,SAAS;QACtEM,QAAQE,YAAY,CAACC,GAAG,CAAC,YAAYxB,SAASyB,EAAE;QAChDJ,QAAQE,YAAY,CAACC,GAAG,CAAC,QAAQ,IAAI,CAACrB,KAAK,CAACuB,IAAI;QAChD,OAAO,IAAI,CAACC,UAAU,CACpB,kBAAkB;QAClBN,QAAQO,QAAQ,GAAGd,OAAO,CAACO,QAAQQ,MAAM,EAAE;IAE/C;IAEAF,WAAWG,MAAc,EAAuB;QAC9C,OAAO;YACLC,kBAAkB;YAClBC,OAAO,IAAI,CAAC7B,KAAK,CAAC6B,KAAK,IAAIC;YAC3BC,QAAQ,IAAI,CAAC/B,KAAK,CAAC+B,MAAM,IAAID;YAC7BE,KAAKL;YACL1B,OAAOC,oBAAoBC,SAAS,CAAC,IAAI,CAACH,KAAK,CAACI,MAAM,EAAEN,WAAWO,GAAG;QACxE;IACF;IAEA,OAAOF,UAAUC,MAAgB,EAAE6B,WAAmB,EAAU;QAC9D,KAAK,MAAMhC,SAASG,OAAQ;YAC1B,IAAIH,SAASgC,aAAa;gBACxB,OAAOhC;YACT;QACF;QACA,OAAOG,MAAM,CAACA,OAAO8B,MAAM,GAAG,EAAE,IAAI;IACtC;AACF"}
|
package/build/AssetSources.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PackagerAsset } from 'react-native';
|
|
2
2
|
export type AssetMetadata = Pick<PackagerAsset, 'httpServerLocation' | 'name' | 'hash' | 'type' | 'scales' | 'width' | 'height'> & {
|
|
3
3
|
uri?: string;
|
|
4
4
|
fileHashes?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["AssetSources.ts"],"sourcesContent":[null],"names":["Platform","getBundleOrigin","PixelRatio","NativeModules","AssetSourceResolver","getManifest2","manifestBaseUrl","resolveDevServerUrl","manifest2","bundleOrigin","debuggerHost","extra","expoGo","scheme","startsWith","selectAssetSource","meta","scale","pickScale","scales","get","index","findIndex","s","hash","fileHashes","uri","fileUris","resolveUri","fileScale","fileExtension","type","encodeURIComponent","suffix","name","params","URLSearchParams","platform","OS","test","httpServerLocation","devServerUrl","developer","baseUrl","URL","searchParams","set","href"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,UAAU,EAAEC,aAAa,
|
|
1
|
+
{"version":3,"sources":["AssetSources.ts"],"sourcesContent":[null],"names":["Platform","getBundleOrigin","PixelRatio","NativeModules","AssetSourceResolver","getManifest2","manifestBaseUrl","resolveDevServerUrl","manifest2","bundleOrigin","debuggerHost","extra","expoGo","scheme","startsWith","selectAssetSource","meta","scale","pickScale","scales","get","index","findIndex","s","hash","fileHashes","uri","fileUris","resolveUri","fileScale","fileExtension","type","encodeURIComponent","suffix","name","params","URLSearchParams","platform","OS","test","httpServerLocation","devServerUrl","developer","baseUrl","URL","searchParams","set","href"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,UAAU,EAAEC,aAAa,QAA4B,eAAe;AAE7E,OAAOC,yBAAyB,wBAAwB;AACxD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAiBhE,SAASC,oBACPC,SAAuD;IAEvD,MAAMC,eAAeR;IACrB,IAAIQ,cAAc;QAChB,OAAOA;IACT;IACA,MAAMC,eAAeF,UAAUG,KAAK,EAAEC,QAAQF;IAC9C,IAAI,CAACA,cAAc;QACjB,OAAO;IACT;IACA,MAAM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YAAYnC,oBAAoBC,aAAa;IAC5F,IAAIiC,cAAc;QAChB,MAAME,UAAU,IAAIC,IAAI5B,KAAKwB,kBAAkB,GAAGP,QAAQQ;QAE1DE,QAAQE,YAAY,CAACC,GAAG,CAAC,YAAY9C,SAASsC,EAAE;QAChDK,QAAQE,YAAY,CAACC,GAAG,CAAC,QAAQ9B,KAAKQ,IAAI;QAC1C,OAAO;YACLE,KAAKiB,QAAQI,IAAI;YACjBvB;QACF;IACF;IAEA,wDAAwD;IACxD,IAAIrB,aAAa,CAAC,iBAAiB,EAAE;QACnC,OAAO;YAAEuB,KAAK,CAAC,0CAA0C,EAAEM,mBAAmBR,OAAO;YAAEA;QAAK;IAC9F;IAEA,gGAAgG;IAChG,+FAA+F;IAC/F,kGAAkG;IAClG,4BAA4B;IAC5B,OAAO;QAAEE,KAAK;QAAIF;IAAK;AACzB;AAEA;;;;CAIC,GACD,OAAO,SAASI,WAAWF,GAAW;IACpC,yDAAyD;IACzD,OAAOpB,kBAAkB,IAAIsC,IAAIlB,KAAKpB,iBAAiByC,IAAI,GAAGrB;AAChE"}
|
package/build/index.js
CHANGED
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,OAAO,aAAa;AAEpB,cAAc,UAAU;AACxB,cAAc,eAAe"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AssetRegistry } from 'react-native';
|
|
2
2
|
import AssetSourceResolver from './AssetSourceResolver';
|
|
3
3
|
let _customSourceTransformer;
|
|
4
4
|
export function setCustomSourceTransformer(transformer) {
|
|
@@ -11,7 +11,7 @@ export function setCustomSourceTransformer(transformer) {
|
|
|
11
11
|
if (typeof source === 'object') {
|
|
12
12
|
return source;
|
|
13
13
|
}
|
|
14
|
-
const asset = getAssetByID(source);
|
|
14
|
+
const asset = AssetRegistry.getAssetByID(source);
|
|
15
15
|
if (!asset) {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["resolveAssetSource.ts"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"sources":["resolveAssetSource.ts"],"sourcesContent":[null],"names":["AssetRegistry","AssetSourceResolver","_customSourceTransformer","setCustomSourceTransformer","transformer","resolveAssetSource","source","asset","getAssetByID","resolver","defaultAsset","Object","defineProperty","get","pickScale"],"mappings":"AAAA,SAASA,aAAa,QAAQ,eAAe;AAG7C,OAAOC,yBAAyB,wBAAwB;AAExD,IAAIC;AAEJ,OAAO,SAASC,2BACdC,WAAmE;IAEnEF,2BAA2BE;AAC7B;AASA;;;CAGC,GACD,SAASC,mBAAmBC,MAAW;IACrC,IAAI,OAAOA,WAAW,UAAU;QAC9B,OAAOA;IACT;IAEA,MAAMC,QAAQP,cAAcQ,YAAY,CAACF;IACzC,IAAI,CAACC,OAAO;QACV,OAAO;IACT;IAEA,MAAME,WAAW,IAAIR,oBACnB,8CAA8C;IAC9C,oBACA,MACAM;IAEF,IAAIL,0BAA0B;QAC5B,OAAOA,yBAAyBO;IAClC;IACA,OAAOA,SAASC,YAAY;AAC9B;AAEAC,OAAOC,cAAc,CAACP,oBAAoB,8BAA8B;IACtEQ;QACE,OAAOV;IACT;AACF;AAEA,eAAeE,mBAAyC;AAExD,OAAO,MAAM,EAAES,SAAS,EAAE,GAAGb,oBAAoB"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "expo.modules.asset",
|
|
5
5
|
"module": "expo.modules.asset",
|
|
6
|
-
"version": "58.0.
|
|
6
|
+
"version": "58.0.16",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.asset-58.0.
|
|
28
|
-
"url": "expo.modules.asset-58.0.
|
|
27
|
+
"name": "expo.modules.asset-58.0.16.aar",
|
|
28
|
+
"url": "expo.modules.asset-58.0.16.aar",
|
|
29
29
|
"size": 30506,
|
|
30
30
|
"sha512": "488b36ee63485a81f93ea026c034315250fc970aa635148fc231019b4123ba5718bfe342a019e2d492224857da29bbbbbd1c74490113e2992f3ec155d5d2b7aa",
|
|
31
31
|
"sha256": "6638572bc255e7dd1653db31deff0bc5150b52a04b0fc4e9d9db5ac63e7cbbf8",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
],
|
|
79
79
|
"files": [
|
|
80
80
|
{
|
|
81
|
-
"name": "expo.modules.asset-58.0.
|
|
82
|
-
"url": "expo.modules.asset-58.0.
|
|
81
|
+
"name": "expo.modules.asset-58.0.16.aar",
|
|
82
|
+
"url": "expo.modules.asset-58.0.16.aar",
|
|
83
83
|
"size": 30506,
|
|
84
84
|
"sha512": "488b36ee63485a81f93ea026c034315250fc970aa635148fc231019b4123ba5718bfe342a019e2d492224857da29bbbbbd1c74490113e2992f3ec155d5d2b7aa",
|
|
85
85
|
"sha256": "6638572bc255e7dd1653db31deff0bc5150b52a04b0fc4e9d9db5ac63e7cbbf8",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
},
|
|
99
99
|
"files": [
|
|
100
100
|
{
|
|
101
|
-
"name": "expo.modules.asset-58.0.
|
|
102
|
-
"url": "expo.modules.asset-58.0.
|
|
101
|
+
"name": "expo.modules.asset-58.0.16-sources.jar",
|
|
102
|
+
"url": "expo.modules.asset-58.0.16-sources.jar",
|
|
103
103
|
"size": 4034,
|
|
104
104
|
"sha512": "9a481faff8f2de1bf629dd0f4a66db1685a5dd4455cc881deb2adbc04471ee8dd096b8c65d2b0ff1460c39011cb9ee9f24eb4273a08496a8ae5e683a8da0b099",
|
|
105
105
|
"sha256": "7088014d29ebd4efb4c3911b5d21ea193a7b935c494abf052ada90f00e914f55",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c1fe35b65a8a1692aef4a7333a7b24d6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e36bdf40154ed3179ada3cbae6b4c3f8a7ada691
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9978c4bee56f5dd4e4b88e9bb8954aa23892f81c9b982cf146f11d23ddf396e4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8b105fe1f8f092f830baa8e8303ed81c0fc7cafb92ece01ee12fca06ab38c02432e26d53aa221840e58ae2fe44b3bf48a07fc1a3fd64b715801e4d7f588f6f77
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>expo.modules.asset</groupId>
|
|
11
11
|
<artifactId>expo.modules.asset</artifactId>
|
|
12
|
-
<version>58.0.
|
|
12
|
+
<version>58.0.16</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.asset</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c5ca6d04ef53c6372758da71316892ee
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
28ba741ed443af2424bac51dd5367ff561c9cf74
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ad3df8a7f54fa144131e2b907baae6be3e233162a20319285aeedefbd493668d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ca2cdb9c3a1dda522b9a9f0736442526e8eb93a6e680eb2160b2f716e49354c1856f1c733db9d4183f6aa694faf3c509a4f9cd8d8c415e250bb10faa7b991ec5
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-asset",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.16",
|
|
4
4
|
"description": "An Expo universal module to download assets and pass them into other APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"asset",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"expo-constants": "~58.0.12"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@expo/internal-scripts": "58.0.
|
|
55
|
+
"@expo/internal-scripts": "58.0.3",
|
|
56
56
|
"@testing-library/react-native": "^14.0.1",
|
|
57
57
|
"@types/jest": "^30.0.0",
|
|
58
58
|
"@types/node": "^22.14.0",
|
package/src/Asset.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform } from 'expo-modules-core';
|
|
2
|
-
import {
|
|
2
|
+
import { AssetRegistry } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { type AssetMetadata, selectAssetSource } from './AssetSources';
|
|
5
5
|
import * as AssetUris from './AssetUris';
|
|
@@ -24,6 +24,22 @@ type DownloadPromiseCallbacks = {
|
|
|
24
24
|
reject: (error: Error) => void;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
// @docsMissing
|
|
28
|
+
interface VirtualAssetModule {
|
|
29
|
+
uri: string;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function isVirtualAsset(assetModule: unknown): assetModule is VirtualAssetModule {
|
|
35
|
+
return (
|
|
36
|
+
!!assetModule &&
|
|
37
|
+
typeof assetModule === 'object' &&
|
|
38
|
+
'uri' in assetModule &&
|
|
39
|
+
typeof assetModule.uri === 'string'
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
27
43
|
export type { AssetMetadata } from './AssetSources';
|
|
28
44
|
|
|
29
45
|
/**
|
|
@@ -140,42 +156,36 @@ export class Asset {
|
|
|
140
156
|
// @needsAudit
|
|
141
157
|
/**
|
|
142
158
|
* Returns the [`Asset`](#asset) instance representing an asset given its module or URL.
|
|
143
|
-
* @param
|
|
159
|
+
* @param assetModule The value of `require('path/to/file')` for the asset or external
|
|
144
160
|
* network URL
|
|
145
161
|
* @return The [`Asset`](#asset) instance for the asset.
|
|
146
162
|
*/
|
|
147
|
-
static fromModule(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (typeof virtualAssetModule === 'string') {
|
|
151
|
-
return Asset.fromURI(virtualAssetModule);
|
|
163
|
+
static fromModule(assetModule: number | string | VirtualAssetModule): Asset {
|
|
164
|
+
if (typeof assetModule === 'string') {
|
|
165
|
+
return Asset.fromURI(assetModule);
|
|
152
166
|
}
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
'uri' in virtualAssetModule &&
|
|
156
|
-
typeof virtualAssetModule.uri === 'string'
|
|
157
|
-
) {
|
|
158
|
-
const extension = AssetUris.getFileExtension(virtualAssetModule.uri);
|
|
167
|
+
if (isVirtualAsset(assetModule)) {
|
|
168
|
+
const extension = AssetUris.getFileExtension(assetModule.uri);
|
|
159
169
|
return new Asset({
|
|
160
170
|
name: '',
|
|
161
171
|
type: extension.startsWith('.') ? extension.substring(1) : extension,
|
|
162
172
|
hash: null,
|
|
163
|
-
uri:
|
|
164
|
-
width:
|
|
165
|
-
height:
|
|
173
|
+
uri: assetModule.uri,
|
|
174
|
+
width: assetModule.width,
|
|
175
|
+
height: assetModule.height,
|
|
166
176
|
});
|
|
167
177
|
}
|
|
168
178
|
|
|
169
|
-
const meta = getAssetByID(
|
|
179
|
+
const meta = AssetRegistry.getAssetByID(assetModule);
|
|
170
180
|
if (!meta) {
|
|
171
|
-
throw new Error(`Module "${
|
|
181
|
+
throw new Error(`Module "${assetModule}" is missing from the asset registry`);
|
|
172
182
|
}
|
|
173
183
|
|
|
174
184
|
// Outside of the managed env we need the moduleId to initialize the asset
|
|
175
185
|
// because resolveAssetSource depends on it
|
|
176
186
|
if (!IS_ENV_WITH_LOCAL_ASSETS) {
|
|
177
187
|
// null-check is performed above with `getAssetByID`.
|
|
178
|
-
const { uri } = resolveAssetSource(
|
|
188
|
+
const { uri } = resolveAssetSource(assetModule)!;
|
|
179
189
|
|
|
180
190
|
const asset = new Asset({
|
|
181
191
|
name: meta.name,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Platform } from 'expo-modules-core';
|
|
2
|
-
import { PixelRatio } from 'react-native';
|
|
3
|
-
import type { PackagerAsset } from 'react-native/asset-registry';
|
|
2
|
+
import { PixelRatio, type PackagerAsset } from 'react-native';
|
|
4
3
|
|
|
5
4
|
import type { AssetMetadata } from './AssetSources';
|
|
6
5
|
|
package/src/AssetSources.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Platform } from 'expo-modules-core';
|
|
2
2
|
import { getBundleOrigin } from 'expo/internal/bundle-origin';
|
|
3
|
-
import { PixelRatio, NativeModules } from 'react-native';
|
|
4
|
-
import type { PackagerAsset } from 'react-native/asset-registry';
|
|
3
|
+
import { PixelRatio, NativeModules, type PackagerAsset } from 'react-native';
|
|
5
4
|
|
|
6
5
|
import AssetSourceResolver from './AssetSourceResolver';
|
|
7
6
|
import { getManifest2, manifestBaseUrl } from './PlatformUtils';
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AssetRegistry } from 'react-native';
|
|
2
2
|
|
|
3
3
|
import type { ResolvedAssetSource } from './AssetSourceResolver';
|
|
4
4
|
import AssetSourceResolver from './AssetSourceResolver';
|
|
@@ -27,7 +27,7 @@ function resolveAssetSource(source: any): ResolvedAssetSource | null {
|
|
|
27
27
|
return source;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const asset = getAssetByID(source);
|
|
30
|
+
const asset = AssetRegistry.getAssetByID(source);
|
|
31
31
|
if (!asset) {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// The `react-native/asset-registry` build entry point ships untyped. Its exports are the
|
|
2
|
-
// `AssetRegistry` API from `react-native`, which Expo's Metro resolver serves on every platform.
|
|
3
|
-
declare module 'react-native/asset-registry' {
|
|
4
|
-
export type AssetDestPathResolver = 'android' | 'generic';
|
|
5
|
-
|
|
6
|
-
export type PackagerAsset = Readonly<{
|
|
7
|
-
fileSystemLocation: string;
|
|
8
|
-
httpServerLocation: string;
|
|
9
|
-
width: number | undefined;
|
|
10
|
-
height: number | undefined;
|
|
11
|
-
scales: number[];
|
|
12
|
-
hash: string;
|
|
13
|
-
name: string;
|
|
14
|
-
type: string;
|
|
15
|
-
resolver?: AssetDestPathResolver | undefined;
|
|
16
|
-
}>;
|
|
17
|
-
|
|
18
|
-
export function registerAsset(asset: PackagerAsset): number;
|
|
19
|
-
|
|
20
|
-
// NOTE(@kitten): Custom override supported in Expo only
|
|
21
|
-
interface VirtualAssetModule {
|
|
22
|
-
uri: string;
|
|
23
|
-
width: number;
|
|
24
|
-
height: number;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getAssetByID(input: number | VirtualAssetModule): PackagerAsset | undefined;
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
15634485c98bb9d6acf530aa8297aa0c
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e7bf53dd0853ed7b877e1f6706bd758e5d8e3acc
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
abfe5bfaa0233aa9878c0f871e8bbc812c65ed2cd76485ea982cb2176c173aee
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f729a33d59fb155b74977b7c70f49b4786fcd169d28d72f4e2803ac74f55d4f50bb61a3b32430e2c0e6cfa3b99810334646236f44fe2d3bdc89618d5479c9183
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fa57b331e61e3f3f5a2d2e00193c51e9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
072b2b8f6a13b7a510b1ae68c6552a2ef2a38e25
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bf67b92d9125312957140d70e94199ffc7e73495f50b3174c7162817201d1141
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
9e35598bae10bca75ff57bb6b0cb8b2ac64d502f4596ee294b131583157ff1ddce330b084665f5ccc3d0f47db8828708100f2aa472219f8887147cbcaf1d8ec5
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// The `react-native/asset-registry` build entry point ships untyped. Its exports are the
|
|
2
|
-
// `AssetRegistry` API from `react-native`, which Expo's Metro resolver serves on every platform.
|
|
3
|
-
declare module 'react-native/asset-registry' {
|
|
4
|
-
export type AssetDestPathResolver = 'android' | 'generic';
|
|
5
|
-
|
|
6
|
-
export type PackagerAsset = Readonly<{
|
|
7
|
-
fileSystemLocation: string;
|
|
8
|
-
httpServerLocation: string;
|
|
9
|
-
width: number | undefined;
|
|
10
|
-
height: number | undefined;
|
|
11
|
-
scales: number[];
|
|
12
|
-
hash: string;
|
|
13
|
-
name: string;
|
|
14
|
-
type: string;
|
|
15
|
-
resolver?: AssetDestPathResolver | undefined;
|
|
16
|
-
}>;
|
|
17
|
-
|
|
18
|
-
export function registerAsset(asset: PackagerAsset): number;
|
|
19
|
-
|
|
20
|
-
// NOTE(@kitten): Custom override supported in Expo only
|
|
21
|
-
interface VirtualAssetModule {
|
|
22
|
-
uri: string;
|
|
23
|
-
width: number;
|
|
24
|
-
height: number;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getAssetByID(input: number | VirtualAssetModule): PackagerAsset | undefined;
|
|
28
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|