@symbiote-native/asset 0.1.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/LICENSE +21 -0
- package/README.md +198 -0
- package/build/angular/index.d.ts +2 -0
- package/build/angular/index.js +4 -0
- package/build/angular/services/assets.service/index.d.ts +8 -0
- package/build/angular/services/assets.service/index.js +64 -0
- package/build/core/asset-fx.d.ts +1 -0
- package/build/core/asset-fx.js +24 -0
- package/build/core/asset-sources.d.ts +13 -0
- package/build/core/asset-sources.js +50 -0
- package/build/core/asset-uris.d.ts +3 -0
- package/build/core/asset-uris.js +33 -0
- package/build/core/asset.d.ts +35 -0
- package/build/core/asset.js +158 -0
- package/build/core/index.d.ts +3 -0
- package/build/core/index.js +2 -0
- package/build/core/local-assets.d.ts +1 -0
- package/build/core/local-assets.js +16 -0
- package/build/core/native-module.d.ts +4 -0
- package/build/core/native-module.js +2 -0
- package/build/core/platform-utils.d.ts +5 -0
- package/build/core/platform-utils.js +28 -0
- package/build/react/hooks/use-assets/index.d.ts +2 -0
- package/build/react/hooks/use-assets/index.js +14 -0
- package/build/react/index.d.ts +2 -0
- package/build/react/index.js +3 -0
- package/build/solid/index.d.ts +2 -0
- package/build/solid/index.js +5 -0
- package/build/solid/primitives/create-assets.d.ts +6 -0
- package/build/solid/primitives/create-assets.js +10 -0
- package/build/svelte/index.d.ts +2 -0
- package/build/svelte/index.js +5 -0
- package/build/svelte/runes/use-assets.svelte.d.ts +5 -0
- package/build/svelte/runes/use-assets.svelte.js +24 -0
- package/build/vue/composables/use-assets/index.d.ts +6 -0
- package/build/vue/composables/use-assets/index.js +18 -0
- package/build/vue/index.d.ts +2 -0
- package/build/vue/index.js +3 -0
- package/build-ngc/angular/index.d.ts +2 -0
- package/build-ngc/angular/index.js +5 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/services/assets.service/index.d.ts +11 -0
- package/build-ngc/angular/services/assets.service/index.js +24 -0
- package/build-ngc/angular/services/assets.service/index.js.map +1 -0
- package/build-ngc/core/asset-fx.d.ts +1 -0
- package/build-ngc/core/asset-fx.js +25 -0
- package/build-ngc/core/asset-fx.js.map +1 -0
- package/build-ngc/core/asset-sources.d.ts +13 -0
- package/build-ngc/core/asset-sources.js +51 -0
- package/build-ngc/core/asset-sources.js.map +1 -0
- package/build-ngc/core/asset-uris.d.ts +3 -0
- package/build-ngc/core/asset-uris.js +34 -0
- package/build-ngc/core/asset-uris.js.map +1 -0
- package/build-ngc/core/asset.d.ts +35 -0
- package/build-ngc/core/asset.js +159 -0
- package/build-ngc/core/asset.js.map +1 -0
- package/build-ngc/core/index.d.ts +3 -0
- package/build-ngc/core/index.js +3 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/local-assets.d.ts +1 -0
- package/build-ngc/core/local-assets.js +17 -0
- package/build-ngc/core/local-assets.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +4 -0
- package/build-ngc/core/native-module.js +3 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/platform-utils.d.ts +5 -0
- package/build-ngc/core/platform-utils.js +29 -0
- package/build-ngc/core/platform-utils.js.map +1 -0
- package/native-link.json +12 -0
- package/package.json +151 -0
- package/src/angular/index.ts +4 -0
- package/src/angular/services/assets.service/index.ts +21 -0
- package/src/core/asset-fx.ts +30 -0
- package/src/core/asset-sources.ts +80 -0
- package/src/core/asset-uris.ts +51 -0
- package/src/core/asset.ts +212 -0
- package/src/core/index.ts +8 -0
- package/src/core/local-assets.ts +22 -0
- package/src/core/native-module.ts +11 -0
- package/src/core/platform-utils.ts +47 -0
- package/src/core/ts-declarations/react-native-assets.d.ts +75 -0
- package/src/react/hooks/use-assets/index.ts +19 -0
- package/src/react/index.ts +4 -0
- package/src/solid/index.ts +6 -0
- package/src/solid/primitives/create-assets.ts +16 -0
- package/src/svelte/index.ts +6 -0
- package/src/svelte/runes/use-assets.svelte.ts +30 -0
- package/src/svelte/svelte-ambient.d.ts +3 -0
- package/src/vue/composables/use-assets/index.ts +30 -0
- package/src/vue/index.ts +4 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Constants from 'expo-constants';
|
|
2
|
+
export declare const IS_ENV_WITH_LOCAL_ASSETS: boolean;
|
|
3
|
+
export declare function getLocalAssets(): Record<string, string>;
|
|
4
|
+
export declare function getManifest2(): typeof Constants.__unsafeNoWarnManifest2;
|
|
5
|
+
export declare const manifestBaseUrl: string | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Ported from expo-asset/src/PlatformUtils.ts (sdk-57) — real logic, not a stub. Every check
|
|
2
|
+
// here (ExpoGo/expo-updates native modules, the classic-updates manifest) naturally resolves to
|
|
3
|
+
// "absent" in a bare app that ships neither, matching upstream's own designed fallback.
|
|
4
|
+
import Constants from 'expo-constants';
|
|
5
|
+
import { requireNativeModule, requireOptionalNativeModule, } from 'expo-modules-core';
|
|
6
|
+
import { getManifestBaseUrl } from './asset-uris.js';
|
|
7
|
+
const ExpoUpdates = requireOptionalNativeModule('ExpoUpdates');
|
|
8
|
+
function isRunningInExpoGo() {
|
|
9
|
+
try {
|
|
10
|
+
return requireNativeModule('ExpoGo') != null;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const expoUpdatesIsInstalledAndEnabled = !!ExpoUpdates?.isEnabled;
|
|
17
|
+
const expoUpdatesIsUsingEmbeddedAssets = ExpoUpdates?.isUsingEmbeddedAssets;
|
|
18
|
+
const shouldUseUpdatesAssetResolution = expoUpdatesIsInstalledAndEnabled && !expoUpdatesIsUsingEmbeddedAssets;
|
|
19
|
+
export const IS_ENV_WITH_LOCAL_ASSETS = isRunningInExpoGo() || shouldUseUpdatesAssetResolution;
|
|
20
|
+
export function getLocalAssets() {
|
|
21
|
+
return ExpoUpdates?.localAssets ?? {};
|
|
22
|
+
}
|
|
23
|
+
export function getManifest2() {
|
|
24
|
+
return Constants.__unsafeNoWarnManifest2;
|
|
25
|
+
}
|
|
26
|
+
export const manifestBaseUrl = Constants.experienceUrl
|
|
27
|
+
? getManifestBaseUrl(Constants.experienceUrl)
|
|
28
|
+
: null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// React lifecycle wiring over the framework-agnostic core (core/asset.ts). Loads once on mount;
|
|
2
|
+
// upstream's own contract ("the assets are not reloaded when you dynamically change the asset
|
|
3
|
+
// list") is preserved by the empty dependency array.
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
|
+
import { Asset } from '../../../core/index.js';
|
|
6
|
+
export function useAssets(moduleIds) {
|
|
7
|
+
const [assets, setAssets] = useState();
|
|
8
|
+
const [error, setError] = useState();
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
Asset.loadAsync(moduleIds).then(setAssets).catch(setError);
|
|
11
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
|
+
}, []);
|
|
13
|
+
return [assets, error];
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @symbiote-native/asset/solid: the Solid entry over the framework-agnostic core — mirrors the
|
|
2
|
+
// lifecycle-bucket naming convention of adapters/solid/src/primitives (never `hooks`/
|
|
3
|
+
// `composables`/`runes`, those are React's, Vue's and Svelte's terms).
|
|
4
|
+
export { createAssets } from './primitives/create-assets.js';
|
|
5
|
+
export * from '../core/index.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// createAssets — the Solid twin of React's useAssets hook, over the framework-agnostic core
|
|
2
|
+
// (core/asset.ts). Loads once from the primitive body, matching upstream's own contract.
|
|
3
|
+
import { createSignal } from 'solid-js';
|
|
4
|
+
import { Asset } from '../../core/index.js';
|
|
5
|
+
export function createAssets(moduleIds) {
|
|
6
|
+
const [assets, setAssets] = createSignal(undefined);
|
|
7
|
+
const [error, setError] = createSignal(undefined);
|
|
8
|
+
Asset.loadAsync(moduleIds).then(setAssets).catch(setError);
|
|
9
|
+
return { assets, error };
|
|
10
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @symbiote-native/asset/svelte: the Svelte entry over the framework-agnostic core — mirrors the
|
|
2
|
+
// lifecycle-bucket naming convention of adapters/svelte/src/runes (never `hooks`/`composables`,
|
|
3
|
+
// those are React's and Vue's terms).
|
|
4
|
+
export { useAssets } from './runes/use-assets.svelte';
|
|
5
|
+
export * from '../core/index.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Svelte lifecycle wiring over the framework-agnostic core (core/asset.ts). Loads once per
|
|
2
|
+
// mount ($effect with no read of its own state), matching upstream's useAssets contract.
|
|
3
|
+
import { Asset } from '../../core/index.js';
|
|
4
|
+
export function useAssets(moduleIds) {
|
|
5
|
+
let assets = $state(undefined);
|
|
6
|
+
let error = $state(undefined);
|
|
7
|
+
$effect(() => {
|
|
8
|
+
Asset.loadAsync(moduleIds)
|
|
9
|
+
.then(loaded => {
|
|
10
|
+
assets = loaded;
|
|
11
|
+
})
|
|
12
|
+
.catch((err) => {
|
|
13
|
+
error = err;
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
get assets() {
|
|
18
|
+
return assets;
|
|
19
|
+
},
|
|
20
|
+
get error() {
|
|
21
|
+
return error;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Vue lifecycle wiring over the framework-agnostic core (core/asset.ts). Loads once on mount,
|
|
2
|
+
// matching upstream's own useAssets contract (a changed moduleIds prop is not reloaded).
|
|
3
|
+
import { onMounted, ref, shallowRef, } from '@vue/runtime-core';
|
|
4
|
+
import { Asset } from '../../../core/index.js';
|
|
5
|
+
export function useAssets(moduleIds) {
|
|
6
|
+
const assets = shallowRef();
|
|
7
|
+
const error = ref();
|
|
8
|
+
onMounted(() => {
|
|
9
|
+
Asset.loadAsync(moduleIds)
|
|
10
|
+
.then(loaded => {
|
|
11
|
+
assets.value = loaded;
|
|
12
|
+
})
|
|
13
|
+
.catch((err) => {
|
|
14
|
+
error.value = err;
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
return { assets, error };
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,+CAA+C;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import { Asset } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class AssetsService {
|
|
5
|
+
connect(moduleIds: number | number[]): {
|
|
6
|
+
assets: Signal<Asset[] | undefined>;
|
|
7
|
+
error: Signal<Error | undefined>;
|
|
8
|
+
};
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AssetsService, never>;
|
|
10
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AssetsService>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Injectable, signal } from '@angular/core';
|
|
2
|
+
import { Asset } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
// Angular twin of React's useAssets hook and Vue's useAssets composable — connect(ids) returns
|
|
5
|
+
// a Signal pair, e.g. `readonly assets = inject(AssetsService).connect([require('./a.jpg')])`.
|
|
6
|
+
export class AssetsService {
|
|
7
|
+
connect(moduleIds) {
|
|
8
|
+
const assets = signal(undefined, /* @ts-ignore */
|
|
9
|
+
...(ngDevMode ? [{ debugName: "assets" }] : /* istanbul ignore next */ []));
|
|
10
|
+
const error = signal(undefined, /* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
12
|
+
Asset.loadAsync(moduleIds)
|
|
13
|
+
.then(loaded => assets.set(loaded))
|
|
14
|
+
.catch((err) => error.set(err));
|
|
15
|
+
return { assets: assets.asReadonly(), error: error.asReadonly() };
|
|
16
|
+
}
|
|
17
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AssetsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
18
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AssetsService, providedIn: 'root' });
|
|
19
|
+
}
|
|
20
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AssetsService, decorators: [{
|
|
21
|
+
type: Injectable,
|
|
22
|
+
args: [{ providedIn: 'root' }]
|
|
23
|
+
}] });
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/angular/services/assets.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;;AAEtC,+FAA+F;AAC/F,+FAA+F;AAE/F,MAAM,OAAO,aAAa;IACxB,OAAO,CAAC,SAA4B;QAIlC,MAAM,MAAM,GAAG,MAAM,CAAsB,SAAS;mFAAC,CAAC;QACtD,MAAM,KAAK,GAAG,MAAM,CAAoB,SAAS;kFAAC,CAAC;QAEnD,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;aACvB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;aAClC,KAAK,CAAC,CAAC,GAAU,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC;IACpE,CAAC;uGAbU,aAAa;2GAAb,aAAa,cADA,MAAM;;2FACnB,aAAa;kBADzB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Ported from expo-asset/src/Asset.fx.ts (sdk-57). Overrides RN's own Image asset resolution
|
|
2
|
+
// for a classic-updates/Expo-Go env — a no-op import in a bare app (IS_ENV_WITH_LOCAL_ASSETS
|
|
3
|
+
// is false), imported for its side effect from core/index.ts, matching upstream's own index.ts.
|
|
4
|
+
import resolveAssetSource, {} from 'react-native/Libraries/Image/resolveAssetSource';
|
|
5
|
+
import { Asset, ANDROID_EMBEDDED_URL_BASE_RESOURCE } from './asset';
|
|
6
|
+
import { IS_ENV_WITH_LOCAL_ASSETS } from './platform-utils';
|
|
7
|
+
const expoAssetTransformer = resolver => {
|
|
8
|
+
try {
|
|
9
|
+
if ('fileHashes' in resolver.asset && resolver.asset.fileHashes) {
|
|
10
|
+
const asset = Asset.fromMetadata(resolver.asset);
|
|
11
|
+
if (asset.uri.startsWith(ANDROID_EMBEDDED_URL_BASE_RESOURCE)) {
|
|
12
|
+
return resolver.resourceIdentifierWithoutScale();
|
|
13
|
+
}
|
|
14
|
+
return resolver.fromSource(asset.downloaded && asset.localUri ? asset.localUri : asset.uri);
|
|
15
|
+
}
|
|
16
|
+
return resolver.defaultAsset();
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return resolver.defaultAsset();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
if (IS_ENV_WITH_LOCAL_ASSETS) {
|
|
23
|
+
resolveAssetSource.setCustomSourceTransformer?.(expoAssetTransformer);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=asset-fx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-fx.js","sourceRoot":"","sources":["../../src/core/asset-fx.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,6FAA6F;AAC7F,gGAAgG;AAChG,OAAO,kBAAkB,EAAE,EAE1B,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,kCAAkC,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,MAAM,oBAAoB,GAA6B,QAAQ,CAAC,EAAE;IAChE,IAAI,CAAC;QACH,IAAI,YAAY,IAAI,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YAChE,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACjD,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,kCAAkC,CAAC,EAAE,CAAC;gBAC7D,OAAO,QAAQ,CAAC,8BAA8B,EAAE,CAAC;YACnD,CAAC;YACD,OAAO,QAAQ,CAAC,UAAU,CACxB,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAChE,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC;IACjC,CAAC;AACH,CAAC,CAAC;AAEF,IAAI,wBAAwB,EAAE,CAAC;IAC7B,kBAAkB,CAAC,0BAA0B,EAAE,CAAC,oBAAoB,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PackagerAsset } from '@react-native/assets-registry/registry';
|
|
2
|
+
export type AssetMetadata = Pick<PackagerAsset, 'httpServerLocation' | 'name' | 'hash' | 'type' | 'scales' | 'width' | 'height'> & {
|
|
3
|
+
uri?: string;
|
|
4
|
+
fileHashes?: string[];
|
|
5
|
+
fileUris?: string[];
|
|
6
|
+
};
|
|
7
|
+
export type AssetSource = {
|
|
8
|
+
uri: string;
|
|
9
|
+
hash: string;
|
|
10
|
+
};
|
|
11
|
+
/** Resolves a relative asset URI against the classic-updates manifest base, if any. */
|
|
12
|
+
export declare function resolveUri(uri: string): string;
|
|
13
|
+
export declare function selectAssetSource(meta: AssetMetadata): AssetSource;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Platform } from 'expo-modules-core';
|
|
2
|
+
import { NativeModules, PixelRatio } from 'react-native';
|
|
3
|
+
import AssetSourceResolver from 'react-native/Libraries/Image/AssetSourceResolver';
|
|
4
|
+
import { getManifest2, manifestBaseUrl } from './platform-utils';
|
|
5
|
+
/** Resolves a relative asset URI against the classic-updates manifest base, if any. */
|
|
6
|
+
export function resolveUri(uri) {
|
|
7
|
+
return manifestBaseUrl ? new URL(uri, manifestBaseUrl).href : uri;
|
|
8
|
+
}
|
|
9
|
+
export function selectAssetSource(meta) {
|
|
10
|
+
const scale = AssetSourceResolver.pickScale(meta.scales, PixelRatio.get());
|
|
11
|
+
const index = meta.scales.findIndex(s => s === scale);
|
|
12
|
+
const hash = meta.fileHashes?.[index] ?? meta.fileHashes?.[0] ?? meta.hash;
|
|
13
|
+
const uri = meta.fileUris
|
|
14
|
+
? (meta.fileUris[index] ?? meta.fileUris[0])
|
|
15
|
+
: meta.uri;
|
|
16
|
+
if (uri) {
|
|
17
|
+
return { uri: resolveUri(uri), hash };
|
|
18
|
+
}
|
|
19
|
+
const fileScale = scale === 1 ? '' : `@${scale}x`;
|
|
20
|
+
const fileExtension = meta.type ? `.${encodeURIComponent(meta.type)}` : '';
|
|
21
|
+
const suffix = `/${encodeURIComponent(meta.name)}${fileScale}${fileExtension}`;
|
|
22
|
+
const params = new URLSearchParams({
|
|
23
|
+
platform: Platform.OS,
|
|
24
|
+
hash: meta.hash,
|
|
25
|
+
});
|
|
26
|
+
if (/^https?:\/\//.test(meta.httpServerLocation)) {
|
|
27
|
+
return { uri: meta.httpServerLocation + suffix + '?' + params, hash };
|
|
28
|
+
}
|
|
29
|
+
const manifest2 = getManifest2();
|
|
30
|
+
const scheme = manifestBaseUrl?.startsWith('https://')
|
|
31
|
+
? 'https://'
|
|
32
|
+
: 'http://';
|
|
33
|
+
const devServerUrl = manifest2?.extra?.expoGo?.developer
|
|
34
|
+
? scheme + manifest2.extra.expoGo.debuggerHost
|
|
35
|
+
: null;
|
|
36
|
+
if (devServerUrl) {
|
|
37
|
+
const baseUrl = new URL(meta.httpServerLocation + suffix, devServerUrl);
|
|
38
|
+
baseUrl.searchParams.set('platform', Platform.OS);
|
|
39
|
+
baseUrl.searchParams.set('hash', meta.hash);
|
|
40
|
+
return { uri: baseUrl.href, hash };
|
|
41
|
+
}
|
|
42
|
+
if (NativeModules['ExponentKernel']) {
|
|
43
|
+
return {
|
|
44
|
+
uri: `https://classic-assets.eascdn.net/~assets/${encodeURIComponent(hash)}`,
|
|
45
|
+
hash,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// Locally available on disk (classic-updates embedded asset): no remote URL to build.
|
|
49
|
+
return { uri: '', hash };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=asset-sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-sources.js","sourceRoot":"","sources":["../../src/core/asset-sources.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,mBAAmB,MAAM,kDAAkD,CAAC;AAEnF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAmBjE,uFAAuF;AACvF,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,eAAe,CAAC,CAAC,CAAC,IA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 -0,0 +1,34 @@
|
|
|
1
|
+
// Ported from expo-asset/src/AssetUris.ts (sdk-57).
|
|
2
|
+
function isDevBuild() {
|
|
3
|
+
return Boolean(globalThis.__DEV__);
|
|
4
|
+
}
|
|
5
|
+
function getBasename(pathname) {
|
|
6
|
+
return pathname.substring(pathname.lastIndexOf('/') + 1);
|
|
7
|
+
}
|
|
8
|
+
export function getFilename(url) {
|
|
9
|
+
const { pathname, searchParams } = new URL(url, 'https://e');
|
|
10
|
+
if (isDevBuild() && searchParams.has('unstable_path')) {
|
|
11
|
+
const encodedFilePath = decodeURIComponent(searchParams.get('unstable_path'));
|
|
12
|
+
return getBasename(encodedFilePath);
|
|
13
|
+
}
|
|
14
|
+
return getBasename(pathname);
|
|
15
|
+
}
|
|
16
|
+
export function getFileExtension(url) {
|
|
17
|
+
const filename = getFilename(url);
|
|
18
|
+
const dotIndex = filename.lastIndexOf('.');
|
|
19
|
+
return dotIndex > 0 ? filename.substring(dotIndex) : '';
|
|
20
|
+
}
|
|
21
|
+
// Rebuilds the URL from parts rather than mutating `protocol`/`pathname` in place: react-native's
|
|
22
|
+
// own global.d.ts types those fields readonly (its URL polyfill's actual shape), conflicting with
|
|
23
|
+
// @types/node's writable declaration wherever both are ambient — same net result either way.
|
|
24
|
+
export function getManifestBaseUrl(manifestUrl) {
|
|
25
|
+
const urlObject = new URL(manifestUrl);
|
|
26
|
+
const protocol = urlObject.protocol === 'exp:'
|
|
27
|
+
? 'http:'
|
|
28
|
+
: urlObject.protocol === 'exps:'
|
|
29
|
+
? 'https:'
|
|
30
|
+
: urlObject.protocol;
|
|
31
|
+
const directory = urlObject.pathname.substring(0, urlObject.pathname.lastIndexOf('/') + 1);
|
|
32
|
+
return `${protocol}//${urlObject.host}${directory}`;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=asset-uris.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-uris.js","sourceRoot":"","sources":["../../src/core/asset-uris.ts"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;YAC9B,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC;IAC3B,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAC5C,CAAC,EACD,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CACxC,CAAC;IAEF,OAAO,GAAG,QAAQ,KAAK,SAAS,CAAC,IAAI,GAAG,SAAS,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type AssetMetadata } from './asset-sources';
|
|
2
|
+
export declare const ANDROID_EMBEDDED_URL_BASE_RESOURCE = "file:///android_res/";
|
|
3
|
+
export type AssetDescriptor = {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
hash?: string | null;
|
|
7
|
+
uri: string;
|
|
8
|
+
width?: number | null;
|
|
9
|
+
height?: number | null;
|
|
10
|
+
};
|
|
11
|
+
/** A locally- or remotely-sourced asset: metadata plus loading/caching facilities. */
|
|
12
|
+
export declare class Asset {
|
|
13
|
+
private static byHash;
|
|
14
|
+
private static byUri;
|
|
15
|
+
name: string;
|
|
16
|
+
readonly type: string;
|
|
17
|
+
readonly hash: string | null;
|
|
18
|
+
readonly uri: string;
|
|
19
|
+
localUri: string | null;
|
|
20
|
+
width: number | null;
|
|
21
|
+
height: number | null;
|
|
22
|
+
downloaded: boolean;
|
|
23
|
+
private downloading;
|
|
24
|
+
private downloadCallbacks;
|
|
25
|
+
constructor({ name, type, hash, uri, width, height, }: AssetDescriptor);
|
|
26
|
+
static loadAsync(moduleId: number | number[] | string | string[]): Promise<Asset[]>;
|
|
27
|
+
static fromModule(virtualAssetModule: number | string | {
|
|
28
|
+
uri: string;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
}): Asset;
|
|
32
|
+
static fromMetadata(meta: AssetMetadata): Asset;
|
|
33
|
+
static fromURI(uri: string): Asset;
|
|
34
|
+
downloadAsync(): Promise<this>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// Ported from expo-asset/src/Asset.ts (sdk-57), native-only, no Expo Go/expo-updates.
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
3
|
+
/// <reference path="./ts-declarations/react-native-assets.d.ts" />
|
|
4
|
+
import { getAssetByID } from '@react-native/assets-registry/registry';
|
|
5
|
+
import { Platform } from 'expo-modules-core';
|
|
6
|
+
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
|
|
7
|
+
import { selectAssetSource } from './asset-sources';
|
|
8
|
+
import { getFileExtension } from './asset-uris';
|
|
9
|
+
import { getLocalAssetUri } from './local-assets';
|
|
10
|
+
import { expoAsset } from './native-module';
|
|
11
|
+
import { IS_ENV_WITH_LOCAL_ASSETS } from './platform-utils';
|
|
12
|
+
export const ANDROID_EMBEDDED_URL_BASE_RESOURCE = 'file:///android_res/';
|
|
13
|
+
/** A locally- or remotely-sourced asset: metadata plus loading/caching facilities. */
|
|
14
|
+
export class Asset {
|
|
15
|
+
static byHash = {};
|
|
16
|
+
static byUri = {};
|
|
17
|
+
name;
|
|
18
|
+
type;
|
|
19
|
+
hash = null;
|
|
20
|
+
uri;
|
|
21
|
+
localUri = null;
|
|
22
|
+
width = null;
|
|
23
|
+
height = null;
|
|
24
|
+
downloaded = false;
|
|
25
|
+
downloading = false;
|
|
26
|
+
downloadCallbacks = [];
|
|
27
|
+
constructor({ name, type, hash = null, uri, width, height, }) {
|
|
28
|
+
this.name = name;
|
|
29
|
+
this.type = type;
|
|
30
|
+
this.hash = hash;
|
|
31
|
+
this.uri = uri;
|
|
32
|
+
if (typeof width === 'number')
|
|
33
|
+
this.width = width;
|
|
34
|
+
if (typeof height === 'number')
|
|
35
|
+
this.height = height;
|
|
36
|
+
if (hash) {
|
|
37
|
+
this.localUri = getLocalAssetUri(hash, type);
|
|
38
|
+
if (this.localUri?.startsWith(ANDROID_EMBEDDED_URL_BASE_RESOURCE)) {
|
|
39
|
+
this.uri = this.localUri;
|
|
40
|
+
this.localUri = null;
|
|
41
|
+
}
|
|
42
|
+
else if (this.localUri) {
|
|
43
|
+
this.downloaded = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
static loadAsync(moduleId) {
|
|
48
|
+
const moduleIds = Array.isArray(moduleId) ? moduleId : [moduleId];
|
|
49
|
+
return Promise.all(moduleIds.map(id => Asset.fromModule(id).downloadAsync()));
|
|
50
|
+
}
|
|
51
|
+
static fromModule(virtualAssetModule) {
|
|
52
|
+
if (typeof virtualAssetModule === 'string') {
|
|
53
|
+
return Asset.fromURI(virtualAssetModule);
|
|
54
|
+
}
|
|
55
|
+
if (typeof virtualAssetModule === 'object' &&
|
|
56
|
+
'uri' in virtualAssetModule &&
|
|
57
|
+
typeof virtualAssetModule.uri === 'string') {
|
|
58
|
+
const extension = getFileExtension(virtualAssetModule.uri);
|
|
59
|
+
return new Asset({
|
|
60
|
+
name: '',
|
|
61
|
+
type: extension.startsWith('.') ? extension.substring(1) : extension,
|
|
62
|
+
hash: null,
|
|
63
|
+
uri: virtualAssetModule.uri,
|
|
64
|
+
width: virtualAssetModule.width,
|
|
65
|
+
height: virtualAssetModule.height,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const meta = getAssetByID(virtualAssetModule);
|
|
69
|
+
if (!meta) {
|
|
70
|
+
throw new Error(`Module "${virtualAssetModule}" is missing from the asset registry`);
|
|
71
|
+
}
|
|
72
|
+
// Outside a managed (Expo Go / expo-updates) env, the moduleId is needed because
|
|
73
|
+
// resolveAssetSource depends on it — a classic-updates env resolves by hash instead.
|
|
74
|
+
if (!IS_ENV_WITH_LOCAL_ASSETS) {
|
|
75
|
+
const resolved = resolveAssetSource(virtualAssetModule);
|
|
76
|
+
if (!resolved) {
|
|
77
|
+
throw new Error(`Module "${virtualAssetModule}" could not be resolved to an asset source`);
|
|
78
|
+
}
|
|
79
|
+
const asset = new Asset({
|
|
80
|
+
name: meta.name,
|
|
81
|
+
type: meta.type,
|
|
82
|
+
hash: meta.hash,
|
|
83
|
+
uri: resolved.uri,
|
|
84
|
+
width: meta.width,
|
|
85
|
+
height: meta.height,
|
|
86
|
+
});
|
|
87
|
+
// Android drawable resource names (no scheme) are already usable directly, same as RN's
|
|
88
|
+
// own Image component backward-compat handling.
|
|
89
|
+
if (Platform.OS === 'android' &&
|
|
90
|
+
!resolved.uri.includes(':') &&
|
|
91
|
+
(meta.width || meta.height)) {
|
|
92
|
+
asset.localUri = asset.uri;
|
|
93
|
+
asset.downloaded = true;
|
|
94
|
+
}
|
|
95
|
+
Asset.byHash[meta.hash] = asset;
|
|
96
|
+
return asset;
|
|
97
|
+
}
|
|
98
|
+
return Asset.fromMetadata(meta);
|
|
99
|
+
}
|
|
100
|
+
static fromMetadata(meta) {
|
|
101
|
+
const existing = Asset.byHash[meta.hash];
|
|
102
|
+
if (existing)
|
|
103
|
+
return existing;
|
|
104
|
+
const { uri, hash } = selectAssetSource(meta);
|
|
105
|
+
const asset = new Asset({
|
|
106
|
+
name: meta.name,
|
|
107
|
+
type: meta.type,
|
|
108
|
+
hash,
|
|
109
|
+
uri,
|
|
110
|
+
width: meta.width,
|
|
111
|
+
height: meta.height,
|
|
112
|
+
});
|
|
113
|
+
Asset.byHash[meta.hash] = asset;
|
|
114
|
+
return asset;
|
|
115
|
+
}
|
|
116
|
+
static fromURI(uri) {
|
|
117
|
+
const existing = Asset.byUri[uri];
|
|
118
|
+
if (existing)
|
|
119
|
+
return existing;
|
|
120
|
+
let type;
|
|
121
|
+
if (uri.indexOf(';base64') > -1) {
|
|
122
|
+
type = uri.split(';')[0]?.split('/')[1] ?? '';
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const extension = getFileExtension(uri);
|
|
126
|
+
type = extension.startsWith('.') ? extension.substring(1) : extension;
|
|
127
|
+
}
|
|
128
|
+
const asset = new Asset({ name: '', type, hash: null, uri });
|
|
129
|
+
Asset.byUri[uri] = asset;
|
|
130
|
+
return asset;
|
|
131
|
+
}
|
|
132
|
+
async downloadAsync() {
|
|
133
|
+
if (this.downloaded)
|
|
134
|
+
return this;
|
|
135
|
+
if (this.downloading) {
|
|
136
|
+
await new Promise((resolve, reject) => {
|
|
137
|
+
this.downloadCallbacks.push({ resolve, reject });
|
|
138
|
+
});
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
this.downloading = true;
|
|
142
|
+
try {
|
|
143
|
+
this.localUri = await expoAsset.downloadAsync(this.uri, this.hash, this.type);
|
|
144
|
+
this.downloaded = true;
|
|
145
|
+
this.downloadCallbacks.forEach(({ resolve }) => resolve());
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
const reason = error instanceof Error ? error : new Error(String(error));
|
|
149
|
+
this.downloadCallbacks.forEach(({ reject }) => reject(reason));
|
|
150
|
+
throw reason;
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
this.downloading = false;
|
|
154
|
+
this.downloadCallbacks = [];
|
|
155
|
+
}
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=asset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.js","sourceRoot":"","sources":["../../src/core/asset.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,qEAAqE;AACrE,mEAAmE;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,kBAAkB,MAAM,iDAAiD,CAAC;AAEjF,OAAO,EAAsB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,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I,CAAC;IACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,EACL,kCAAkC,GAEnC,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getLocalAssetUri(hash: string, type: string | null): string | null;
|