mirror of
https://github.com/status-im/metro.git
synced 2025-03-02 19:50:28 +00:00
packager-worker-for-buck: store resolutions at library level
Reviewed By: davidaurelio Differential Revision: D6359267 fbshipit-source-id: 795d451c6ff32c07842e9e067778136180a9988e
This commit is contained in:
parent
6ec09775ef
commit
507fbd7d7e
@ -242,8 +242,35 @@ export type AssetContentsByPath = {
|
|||||||
+[moduleFilePath: string]: $ReadOnlyArray<AssetContents>,
|
+[moduleFilePath: string]: $ReadOnlyArray<AssetContents>,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ResolvedCodeFile = {|
|
||||||
|
+codeFile: TransformedCodeFile,
|
||||||
|
/**
|
||||||
|
* Imagine we have a source file that contains a `require('foo')`. The library
|
||||||
|
* will resolve the path of the module `foo` and store it in this field along
|
||||||
|
* all the other dependencies. For example, it could be
|
||||||
|
* `{'foo': 'bar/foo.js', 'bar': 'node_modules/bar/index.js'}`.
|
||||||
|
*/
|
||||||
|
+filePathsByDependencyName: {|+[dependencyName: string]: string|},
|
||||||
|
|};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describe a set of JavaScript files and the associated assets. It could be
|
||||||
|
* depending on modules from other libraries. To be able to resolve these
|
||||||
|
* dependencies, these libraries need to be provided by callsites (ex. Buck).
|
||||||
|
*/
|
||||||
export type Library = {|
|
export type Library = {|
|
||||||
+files: Array<TransformedCodeFile>,
|
+files: Array<TransformedCodeFile>,
|
||||||
/* cannot be a Map because it's JSONified later on */
|
/* cannot be a Map because it's JSONified later on */
|
||||||
+assets: AssetContentsByPath,
|
+assets: AssetContentsByPath,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Just like a `Library`, but it also contains module resolutions. For example
|
||||||
|
* if there is a `require('foo')` in some JavaScript file, we keep track of the
|
||||||
|
* path it resolves to, ex. `beep/glo/foo.js`.
|
||||||
|
*/
|
||||||
|
export type ResolvedLibrary = {|
|
||||||
|
+files: $ReadOnlyArray<ResolvedCodeFile>,
|
||||||
|
/* cannot be a Map because it's JSONified later on */
|
||||||
|
+assets: AssetContentsByPath,
|
||||||
|
|};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user