mirror of https://github.com/status-im/metro.git
Expose some private methods from the Bundler and the DependencyGraph
Reviewed By: jeanlauliac Differential Revision: D5755556 fbshipit-source-id: cff95e3464154883fd872bf8ab916276a1f09027
This commit is contained in:
parent
70a0916dd2
commit
8c8cfb364f
|
@ -153,7 +153,7 @@ const {hasOwnProperty} = Object;
|
|||
|
||||
class Bundler {
|
||||
_opts: Options;
|
||||
_getModuleId: (opts: Module) => number;
|
||||
_getModuleId: ({path: string}) => number;
|
||||
_transformer: Transformer;
|
||||
_resolverPromise: Promise<Resolver>;
|
||||
_projectRoots: $ReadOnlyArray<string>;
|
||||
|
@ -284,6 +284,10 @@ class Bundler {
|
|||
);
|
||||
}
|
||||
|
||||
getGetModuleIdFn(): ({path: string}) => number {
|
||||
return this._getModuleId;
|
||||
}
|
||||
|
||||
_sourceHMRURL(platform: ?string, hmrpath: string) {
|
||||
return this._hmrURL('', platform, 'bundle', hmrpath);
|
||||
}
|
||||
|
@ -765,7 +769,7 @@ class Bundler {
|
|||
});
|
||||
}
|
||||
|
||||
_generateAssetObjAndCode(
|
||||
generateAssetObjAndCode(
|
||||
module: Module,
|
||||
assetPlugins: Array<string>,
|
||||
platform: ?string = null,
|
||||
|
@ -854,7 +858,7 @@ class Bundler {
|
|||
) {
|
||||
return Promise.all([
|
||||
module.getName(),
|
||||
this._generateAssetObjAndCode(module, assetPlugins, platform),
|
||||
this.generateAssetObjAndCode(module, assetPlugins, platform),
|
||||
]).then(([name, {asset, code, meta}]) => {
|
||||
bundle.addAsset(asset);
|
||||
return new ModuleTransport({
|
||||
|
|
|
@ -250,7 +250,7 @@ class DependencyGraph extends EventEmitter {
|
|||
recursive: boolean,
|
||||
}): Promise<ResolutionResponse<Module, T>> {
|
||||
platform = this._getRequestPlatform(entryPath, platform);
|
||||
const absPath = this._getAbsolutePath(entryPath);
|
||||
const absPath = this.getAbsolutePath(entryPath);
|
||||
const req = new ResolutionRequest({
|
||||
moduleResolver: this._moduleResolver,
|
||||
entryPath: absPath,
|
||||
|
@ -289,7 +289,7 @@ class DependencyGraph extends EventEmitter {
|
|||
return platform;
|
||||
}
|
||||
|
||||
_getAbsolutePath(filePath: string) {
|
||||
getAbsolutePath(filePath: string) {
|
||||
if (isAbsolutePath(filePath)) {
|
||||
return path.resolve(filePath);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue