remove embeddedBundleURL
Reviewed By: fromcelticpark Differential Revision: D6502049 fbshipit-source-id: 31a611cea4c017877c3ce2f7e9a3503723af4c2d
This commit is contained in:
parent
ba31d29dc9
commit
489b98bf10
|
@ -52,19 +52,15 @@ class AssetSourceResolver {
|
||||||
serverUrl: ?string;
|
serverUrl: ?string;
|
||||||
// where the jsbundle is being run from
|
// where the jsbundle is being run from
|
||||||
jsbundleUrl: ?string;
|
jsbundleUrl: ?string;
|
||||||
// where the embedded bundle in the app is stored
|
|
||||||
embeddedBundleUrl: ?string;
|
|
||||||
// the asset to resolve
|
// the asset to resolve
|
||||||
asset: PackagerAsset;
|
asset: PackagerAsset;
|
||||||
|
|
||||||
constructor(serverUrl: ?string,
|
constructor(serverUrl: ?string,
|
||||||
jsbundleUrl: ?string,
|
jsbundleUrl: ?string,
|
||||||
embeddedBundleUrl: ?string,
|
|
||||||
asset: PackagerAsset
|
asset: PackagerAsset
|
||||||
) {
|
) {
|
||||||
this.serverUrl = serverUrl;
|
this.serverUrl = serverUrl;
|
||||||
this.jsbundleUrl = jsbundleUrl;
|
this.jsbundleUrl = jsbundleUrl;
|
||||||
this.embeddedBundleUrl = embeddedBundleUrl;
|
|
||||||
this.asset = asset;
|
this.asset = asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,10 +72,6 @@ class AssetSourceResolver {
|
||||||
return !!(this.jsbundleUrl && this.jsbundleUrl.startsWith('file://'));
|
return !!(this.jsbundleUrl && this.jsbundleUrl.startsWith('file://'));
|
||||||
}
|
}
|
||||||
|
|
||||||
canLoadFromEmbeddedBundledLocation(): boolean {
|
|
||||||
return !!this.embeddedBundleUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultAsset(): ResolvedAssetSource {
|
defaultAsset(): ResolvedAssetSource {
|
||||||
if (this.isLoadedFromServer()) {
|
if (this.isLoadedFromServer()) {
|
||||||
return this.assetServerURL();
|
return this.assetServerURL();
|
||||||
|
@ -123,15 +115,6 @@ class AssetSourceResolver {
|
||||||
return this.fromSource(path + getScaledAssetPath(this.asset));
|
return this.fromSource(path + getScaledAssetPath(this.asset));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolves to the asset that was bundled with the app, with a scaled asset filename
|
|
||||||
* E.g. 'file:///sdcard/bundle/assets/AwesomeModule/icon@2x.png'
|
|
||||||
*/
|
|
||||||
scaledAssetURLInEmbeddedBundleUrl(): ResolvedAssetSource {
|
|
||||||
const path = this.embeddedBundleUrl || 'file://';
|
|
||||||
return this.fromSource(path + getScaledAssetPath(this.asset));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default location of assets bundled with the app, located by
|
* The default location of assets bundled with the app, located by
|
||||||
* resource identifier
|
* resource identifier
|
||||||
|
|
|
@ -19,7 +19,7 @@ const NativeModules = require('NativeModules');
|
||||||
|
|
||||||
import type { ResolvedAssetSource } from 'AssetSourceResolver';
|
import type { ResolvedAssetSource } from 'AssetSourceResolver';
|
||||||
|
|
||||||
let _customSourceTransformer, _serverURL, _scriptURL, _embeddedBundleURL;
|
let _customSourceTransformer, _serverURL, _scriptURL;
|
||||||
|
|
||||||
function getDevServerURL(): ?string {
|
function getDevServerURL(): ?string {
|
||||||
if (_serverURL === undefined) {
|
if (_serverURL === undefined) {
|
||||||
|
@ -60,12 +60,6 @@ function getScriptURL(): ?string {
|
||||||
return _scriptURL;
|
return _scriptURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEmbeddedBundledURL(): ?string {
|
|
||||||
const scriptURL = NativeModules.SourceCode.embeddedBundleURL;
|
|
||||||
_embeddedBundleURL = _coerceLocalScriptURL(scriptURL);
|
|
||||||
return _embeddedBundleURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCustomSourceTransformer(
|
function setCustomSourceTransformer(
|
||||||
transformer: (resolver: AssetSourceResolver) => ResolvedAssetSource,
|
transformer: (resolver: AssetSourceResolver) => ResolvedAssetSource,
|
||||||
): void {
|
): void {
|
||||||
|
@ -89,7 +83,6 @@ function resolveAssetSource(source: any): ?ResolvedAssetSource {
|
||||||
const resolver = new AssetSourceResolver(
|
const resolver = new AssetSourceResolver(
|
||||||
getDevServerURL(),
|
getDevServerURL(),
|
||||||
getScriptURL(),
|
getScriptURL(),
|
||||||
getEmbeddedBundledURL(),
|
|
||||||
asset,
|
asset,
|
||||||
);
|
);
|
||||||
if (_customSourceTransformer) {
|
if (_customSourceTransformer) {
|
||||||
|
|
Loading…
Reference in New Issue