Skip to content

Commit

Permalink
Upgrade to Flow 158 (#6763)
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Aug 29, 2021
1 parent 6e3ff0c commit c08afa2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ untyped-import
untyped-type-import

[version]
0.157.0
0.158.0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
37 changes: 9 additions & 28 deletions packages/core/core/src/public/BundleGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ export default class BundleGraph<TBundle: IBundle>
implements IBundleGraph<TBundle> {
#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<TBundle>;

constructor(
Expand Down Expand Up @@ -117,9 +113,7 @@ export default class BundleGraph<TBundle: IBundle>
): Array<TBundle> {
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(
Expand Down Expand Up @@ -156,7 +150,7 @@ export default class BundleGraph<TBundle: IBundle>
);

if (result != null) {
return this.#createBundle.call(null, result, this.#graph, this.#options);
return this.#createBundle(result, this.#graph, this.#options);
}
}

Expand Down Expand Up @@ -196,17 +190,13 @@ export default class BundleGraph<TBundle: IBundle>
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<TBundle> {
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 {
Expand All @@ -218,17 +208,13 @@ export default class BundleGraph<TBundle: IBundle>
getChildBundles(bundle: IBundle): Array<TBundle> {
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<TBundle> {
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(
Expand Down Expand Up @@ -289,8 +275,7 @@ export default class BundleGraph<TBundle: IBundle>
): ?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),
Expand All @@ -300,17 +285,13 @@ export default class BundleGraph<TBundle: IBundle>
getBundlesWithAsset(asset: IAsset): Array<TBundle> {
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<TBundle> {
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<Symbol> {
Expand Down
36 changes: 7 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit c08afa2

Please sign in to comment.