From 406650e4dcb52284e389f5d2b7f6b1d960d2fcf5 Mon Sep 17 00:00:00 2001 From: Gora Kong <15333808+gorakong@users.noreply.github.com> Date: Thu, 2 Nov 2023 19:57:11 -0700 Subject: [PATCH] Reduce redundancy in the RequestGraph's file nodes (#9360) * remove value objects in file nodes * remove opaque type * restore opaque type --- packages/core/core/src/RequestTracker.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/core/core/src/RequestTracker.js b/packages/core/core/src/RequestTracker.js index 4da53bbb4e4..ed3b0e4e62b 100644 --- a/packages/core/core/src/RequestTracker.js +++ b/packages/core/core/src/RequestTracker.js @@ -13,7 +13,6 @@ import type { import type { ParcelOptions, RequestInvalidation, - InternalFile, InternalFileCreateInvalidation, InternalGlob, } from './types'; @@ -84,7 +83,7 @@ type SerializedRequestGraph = {| invalidateOnBuildNodeIds: Set, |}; -type FileNode = {|id: ContentKey, +type: 'file', value: InternalFile|}; +type FileNode = {|id: ContentKey, +type: 'file'|}; type GlobNode = {|id: ContentKey, +type: 'glob', value: InternalGlob|}; type FileNameNode = {| id: ContentKey, @@ -167,7 +166,6 @@ export type StaticRunOpts = {| const nodeFromFilePath = (filePath: ProjectPath): RequestGraphNode => ({ id: fromProjectPathRelative(filePath), type: 'file', - value: {filePath}, }); const nodeFromGlob = (glob: InternalGlob): RequestGraphNode => ({ @@ -609,7 +607,7 @@ export class RequestGraph extends ContentGraph< let node = nullthrows(this.getNode(nodeId)); switch (node.type) { case 'file': - return {type: 'file', filePath: node.value.filePath}; + return {type: 'file', filePath: toProjectPathUnsafe(node.id)}; case 'env': return {type: 'env', key: node.value.key}; case 'option': @@ -675,7 +673,7 @@ export class RequestGraph extends ContentGraph< requestGraphEdgeTypes.invalidated_by_create_above, ) && isDirectoryInside( - fromProjectPathRelative(matchNode.value.filePath), + fromProjectPathRelative(toProjectPathUnsafe(matchNode.id)), dirname, ) ) {