Skip to content

Commit

Permalink
Upgrade Flow to v0.56.0
Browse files Browse the repository at this point in the history
Reviewed By: calebmer

Differential Revision: D5958715

fbshipit-source-id: 7feda03a9540e69bf8d9b4eb89720248ff43294f
  • Loading branch information
samwgoldman authored and facebook-github-bot committed Oct 3, 2017
1 parent 86a69bf commit 87cfc05
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/metro-bundler/src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ export type ConfigT = {
runBeforeMainModule: Array<string>,
};

/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an error

This comment has been minimized.

Copy link
@grabbou

grabbou Oct 10, 2017

Contributor

All these should list react_native_oss as well as they break the build. What is the motivation behind keeping two separate configurations? All in all, it's better to ignore a bit more than be confused with two?

This comment has been minimized.

Copy link
@grabbou

grabbou Oct 10, 2017

Contributor

For reference, should be:

$FlowFixMe(>=0.56.0 site=react_native_fb,react_native_oss)

This comment has been minimized.

Copy link
@grabbou

grabbou Oct 10, 2017

Contributor

For now, I am going to add react_native_fb ignores to flow config of the 0.50-stable branch to make it green. From here on, we need to either:

  • inline everything and keep using react_native everywhere, as opposed to react_native_fb and react_native_oss
  • ignore errors in this commit by adding react_native_oss to applicable files.

This comment has been minimized.

Copy link
@grabbou

grabbou Oct 11, 2017

Contributor

cc: @cpojer maybe you have insights onto why there such split in naming

* found when Flow v0.56 was deployed. To see the error delete this comment and
* run Flow. */
const DEFAULT = ({
extraNodeModules: Object.create(null),
getAssetExts: () => [],
Expand Down
3 changes: 3 additions & 0 deletions packages/metro-bundler/src/DeltaBundler/DeltaTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ class DeltaTransformer extends EventEmitter {
).map(dep => this._getModuleId({path: dep}));
}

/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.56 was deployed. To see the error delete this
* comment and run Flow. */
return output;
}

Expand Down
3 changes: 3 additions & 0 deletions packages/metro-bundler/src/JSTransformer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class Transformer {

kill() {
if (this._usesFarm && this._workers) {
/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.56 was deployed. To see the error delete this
* comment and run Flow. */
workerFarm.end(this._workers);
}
}
Expand Down
6 changes: 6 additions & 0 deletions packages/metro-bundler/src/Resolver/polyfills/require.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ type VerboseModuleNameForDev = string;
global.require = require;
global.__d = define;

/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.56 was deployed. To see the error delete this comment and
* run Flow. */
const modules: ModuleMap = Object.create(null);
if (__DEV__) {
/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.56 was deployed. To see the error delete this comment
* and run Flow. */
var verboseNamesToModuleIds: {[key: string]: number} = Object.create(null);
}

Expand Down
6 changes: 6 additions & 0 deletions packages/metro-bundler/src/Server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ class Server {

this._reporter = reporter;
this._projectRoots = this._opts.projectRoots;
/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.56 was deployed. To see the error delete this
* comment and run Flow. */
this._bundles = Object.create(null);
this._bundleBuildInfos = new WeakMap();
this._changeWatchers = [];
Expand Down Expand Up @@ -473,6 +476,9 @@ class Server {
}

_clearBundles() {
/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.56 was deployed. To see the error delete this
* comment and run Flow. */
this._bundles = Object.create(null);
}

Expand Down
1 change: 0 additions & 1 deletion packages/metro-bundler/src/node-haste/DependencyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ class DependencyGraph extends EventEmitter {
}

function NotFoundError(...args) {
/* $FlowFixMe: monkey-patching */
Error.call(this);
Error.captureStackTrace(this, this.constructor);
var msg = util.format.apply(util, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ class ResolutionRequest<TModule: Moduleish, TPackage: Packageish> {
}

_resetResolutionCache() {
/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.56 was deployed. To see the error delete this
* comment and run Flow. */
this._immediateResolutionCache = Object.create(null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class ResolutionResponse<TModule: {hash(): string}, TOptions> {
this.mocks = null;
this.numPrependedDependencies = 0;
this.options = options;
/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.56 was deployed. To see the error delete this
* comment and run Flow. */
this._mappings = Object.create(null);
this._finalized = false;
}
Expand Down
6 changes: 6 additions & 0 deletions packages/metro-bundler/src/node-haste/ModuleCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ class ModuleCache {
this._getTransformCacheKey = getTransformCacheKey;
this._globalTransformCache = globalTransformCache;
this._depGraphHelpers = depGraphHelpers;
/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.56 was deployed. To see the error delete this
* comment and run Flow. */
this._moduleCache = Object.create(null);
this._moduleOptions = moduleOptions;
/* $FlowFixMe(>=0.56.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.56 was deployed. To see the error delete this
* comment and run Flow. */
this._packageCache = Object.create(null);
this._packageModuleMap = new WeakMap();
this._platforms = platforms;
Expand Down
1 change: 0 additions & 1 deletion packages/metro-bundler/src/node-haste/Package.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ function getReplacements(pkg: PackageContent): mixed {

// merge with "browser" as default,
// "react-native" as override
// $FlowFixMe(>=0.35.0) browser and rn should be objects
return {...browser, ...rn};
}

Expand Down

1 comment on commit 87cfc05

@fernandopasik
Copy link

@fernandopasik fernandopasik commented on 87cfc05 Oct 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samwgoldman I think you forgot to update package.json flow dependency

Please sign in to comment.