From 733e85f719372c8380fe78de10151adbe3134db7 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Wed, 25 Aug 2021 12:55:02 +0200 Subject: [PATCH] Upgrade to Flow 158 --- .flowconfig | 2 +- package.json | 2 +- packages/core/core/src/public/BundleGraph.js | 37 +++++--------------- yarn.lock | 36 ++++--------------- 4 files changed, 18 insertions(+), 59 deletions(-) diff --git a/.flowconfig b/.flowconfig index 9501a24aa1b..5f8e969f2bd 100644 --- a/.flowconfig +++ b/.flowconfig @@ -36,4 +36,4 @@ untyped-import untyped-type-import [version] -0.157.0 +0.158.0 diff --git a/package.json b/package.json index 854875b9647..e2e43da8ed5 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "cross-env": "^7.0.0", "doctoc": "^1.4.0", "eslint": "^7.20.0", - "flow-bin": "0.157.0", + "flow-bin": "0.158.0", "glob": "^7.1.6", "gulp": "^4.0.2", "gulp-babel": "^8.0.0", diff --git a/packages/core/core/src/public/BundleGraph.js b/packages/core/core/src/public/BundleGraph.js index c538fe2b4de..b94b5d34dcc 100644 --- a/packages/core/core/src/public/BundleGraph.js +++ b/packages/core/core/src/public/BundleGraph.js @@ -50,10 +50,6 @@ export default class BundleGraph implements IBundleGraph { #graph: InternalBundleGraph; #options: ParcelOptions; - // This is invoked as `this.#createBundle.call(null, ...)` below, as private - // properties aren't currently callable in Flow: - // https://github.com/parcel-bundler/parcel/pull/4591#discussion_r422661115 - // https://github.com/facebook/flow/issues/7877 #createBundle: BundleFactory; constructor( @@ -117,9 +113,7 @@ export default class BundleGraph ): Array { return this.#graph .getReferencedBundles(bundleToInternalBundle(bundle), opts) - .map(bundle => - this.#createBundle.call(null, bundle, this.#graph, this.#options), - ); + .map(bundle => this.#createBundle(bundle, this.#graph, this.#options)); } resolveAsyncDependency( @@ -156,7 +150,7 @@ export default class BundleGraph ); if (result != null) { - return this.#createBundle.call(null, result, this.#graph, this.#options); + return this.#createBundle(result, this.#graph, this.#options); } } @@ -196,17 +190,13 @@ export default class BundleGraph bundleGroupToInternalBundleGroup(bundleGroup), opts, ) - .map(bundle => - this.#createBundle.call(null, bundle, this.#graph, this.#options), - ); + .map(bundle => this.#createBundle(bundle, this.#graph, this.#options)); } getBundles(opts?: {|includeInline: boolean|}): Array { return this.#graph .getBundles(opts) - .map(bundle => - this.#createBundle.call(null, bundle, this.#graph, this.#options), - ); + .map(bundle => this.#createBundle(bundle, this.#graph, this.#options)); } isEntryBundleGroup(bundleGroup: IBundleGroup): boolean { @@ -218,17 +208,13 @@ export default class BundleGraph getChildBundles(bundle: IBundle): Array { return this.#graph .getChildBundles(bundleToInternalBundle(bundle)) - .map(bundle => - this.#createBundle.call(null, bundle, this.#graph, this.#options), - ); + .map(bundle => this.#createBundle(bundle, this.#graph, this.#options)); } getParentBundles(bundle: IBundle): Array { return this.#graph .getParentBundles(bundleToInternalBundle(bundle)) - .map(bundle => - this.#createBundle.call(null, bundle, this.#graph, this.#options), - ); + .map(bundle => this.#createBundle(bundle, this.#graph, this.#options)); } getSymbolResolution( @@ -289,8 +275,7 @@ export default class BundleGraph ): ?TContext { return this.#graph.traverseBundles( mapVisitor( - bundle => - this.#createBundle.call(null, bundle, this.#graph, this.#options), + bundle => this.#createBundle(bundle, this.#graph, this.#options), visit, ), startBundle == null ? undefined : bundleToInternalBundle(startBundle), @@ -300,17 +285,13 @@ export default class BundleGraph getBundlesWithAsset(asset: IAsset): Array { return this.#graph .getBundlesWithAsset(assetToAssetValue(asset)) - .map(bundle => - this.#createBundle.call(null, bundle, this.#graph, this.#options), - ); + .map(bundle => this.#createBundle(bundle, this.#graph, this.#options)); } getBundlesWithDependency(dependency: IDependency): Array { return this.#graph .getBundlesWithDependency(dependencyToInternalDependency(dependency)) - .map(bundle => - this.#createBundle.call(null, bundle, this.#graph, this.#options), - ); + .map(bundle => this.#createBundle(bundle, this.#graph, this.#options)); } getUsedSymbols(v: IAsset | IDependency): $ReadOnlySet { diff --git a/yarn.lock b/yarn.lock index c8f16abc319..60860798ea5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2684,15 +2684,7 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" -anymatch@~3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" - integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -anymatch@~3.1.2: +anymatch@~3.1.1, anymatch@~3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== @@ -6009,10 +6001,10 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469" integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== -flow-bin@0.157.0: - version "0.157.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.157.0.tgz#3164b39e17e1a1695d2ace5d4e8d3088bebb3e19" - integrity sha512-SP70r4iBb4a+0NZV1+MtAJYZXGoFp1XvfjirNyeuJiGIXtllHcmJlJWyU1wJQ/fXSFUwY7CcnBNK8cd8PyuP9Q== +flow-bin@0.158.0: + version "0.158.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.158.0.tgz#0a09763d41eb8ec7135ced6a3b9f8fa370a393d8" + integrity sha512-Gk5md8XTwk/M+J5M+rFyS1LJfFen6ldY60jM9+meWixlKf4b0vwdoUO8R7oo471pze+GY+blrnskUeqLDxFJfg== flush-write-stream@^1.0.0, flush-write-stream@^1.0.2: version "1.1.1" @@ -6324,14 +6316,7 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" -glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@~5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" - integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== - dependencies: - is-glob "^4.0.1" - -glob-parent@~5.1.2: +glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@~5.1.0, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -12421,20 +12406,13 @@ supports-color@^6.1.0: dependencies: has-flag "^3.0.0" -supports-color@^7.0.0: +supports-color@^7.0.0, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" -supports-color@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" - integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== - dependencies: - has-flag "^4.0.0" - supports-hyperlinks@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz#4f77b42488765891774b70c79babd87f9bd594bb"