mirror of https://github.com/status-im/metro.git
metro-bundler: fix Flow errors in OSS
Reviewed By: cpojer Differential Revision: D5775151 fbshipit-source-id: 730ab160fdf5ea35f8047eb55a7e2844ba7a7c14
This commit is contained in:
parent
286c5ccdd9
commit
7ccbcc5ebc
|
@ -47,13 +47,13 @@ function optimizeModule(
|
|||
const result = {...details, transformed: {}};
|
||||
const {postMinifyProcess} = optimizationOptions;
|
||||
|
||||
Object.entries(
|
||||
transformed,
|
||||
/* $FlowFixMe(>=0.54.0 site=react_native_fb) This comment suppresses an error
|
||||
* found when Flow v0.54 was deployed. To see the error delete this comment
|
||||
* and run Flow. */
|
||||
).forEach(([k, t: TransformResult]: [*, TransformResult]) => {
|
||||
const optimized = optimize(t, file, code, optimizationOptions);
|
||||
Object.entries(transformed).forEach(([k, t: TransformResult]) => {
|
||||
const optimized = optimize(
|
||||
(t: $FlowFixMe),
|
||||
file,
|
||||
code,
|
||||
optimizationOptions,
|
||||
);
|
||||
const processed = postMinifyProcess({
|
||||
code: optimized.code,
|
||||
map: optimized.map,
|
||||
|
@ -66,7 +66,7 @@ function optimizeModule(
|
|||
return {type: 'code', details: result};
|
||||
}
|
||||
|
||||
function optimize(transformed, file, originalCode, options) {
|
||||
function optimize(transformed: TransformResult, file, originalCode, options) {
|
||||
const {code, dependencyMapName, map} = transformed;
|
||||
const optimized = optimizeCode(code, map, file, options);
|
||||
|
||||
|
|
|
@ -130,7 +130,10 @@ class Resolver {
|
|||
): Promise<ResolutionResponse<Module, T>> {
|
||||
const {platform, recursive = true, prependPolyfills} = options;
|
||||
|
||||
const resolutionResponse = await this._depGraph.getDependencies({
|
||||
const resolutionResponse: ResolutionResponse<
|
||||
Module,
|
||||
T,
|
||||
> = await this._depGraph.getDependencies({
|
||||
entryPath,
|
||||
platform,
|
||||
options: bundlingOptions,
|
||||
|
@ -144,6 +147,7 @@ class Resolver {
|
|||
.forEach(polyfill => resolutionResponse.prependDependency(polyfill));
|
||||
}
|
||||
|
||||
/* $FlowFixMe: monkey patching */
|
||||
resolutionResponse.getModuleId = getModuleId;
|
||||
return resolutionResponse.finalize();
|
||||
}
|
||||
|
|
|
@ -668,7 +668,7 @@ class Server {
|
|||
}),
|
||||
Promise.all(Array.from(outdated, this.getModuleForPath, this)),
|
||||
])
|
||||
.then(([response, changedModules]) => {
|
||||
.then(([response, changedModules]: [$FlowFixMe, *]) => {
|
||||
debug('Update bundle: rebuild shallow bundle');
|
||||
|
||||
changedModules.forEach(m => {
|
||||
|
|
|
@ -1163,17 +1163,17 @@ isstream@~0.1.2:
|
|||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
|
||||
|
||||
jest-docblock@20.1.0-echo.1:
|
||||
version "20.1.0-echo.1"
|
||||
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.1.0-echo.1.tgz#be02f43ee019f97e6b83267c746ac7b40d290fe8"
|
||||
jest-docblock@^21, jest-docblock@^21.0.0:
|
||||
version "21.0.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.0.0.tgz#7dd57568543aec98910f749540afc15fab53a27f"
|
||||
|
||||
jest-haste-map@20.1.0-echo.1:
|
||||
version "20.1.0-echo.1"
|
||||
resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-20.1.0-echo.1.tgz#6dfd0c97bb51a68a35dd98326e04f994157dce81"
|
||||
jest-haste-map@^21:
|
||||
version "21.0.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-21.0.0.tgz#1f099ff6aedb52ec55fa9773ce26e4bbb00b0580"
|
||||
dependencies:
|
||||
fb-watchman "^2.0.0"
|
||||
graceful-fs "^4.1.11"
|
||||
jest-docblock "20.1.0-echo.1"
|
||||
jest-docblock "^21.0.0"
|
||||
micromatch "^2.3.11"
|
||||
sane "^2.0.0"
|
||||
worker-farm "^1.3.1"
|
||||
|
|
Loading…
Reference in New Issue