Skip to content

Commit 406650e

Browse files
authored
Reduce redundancy in the RequestGraph's file nodes (#9360)
* remove value objects in file nodes * remove opaque type * restore opaque type
1 parent 506e762 commit 406650e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/core/core/src/RequestTracker.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {
1313
import type {
1414
ParcelOptions,
1515
RequestInvalidation,
16-
InternalFile,
1716
InternalFileCreateInvalidation,
1817
InternalGlob,
1918
} from './types';
@@ -84,7 +83,7 @@ type SerializedRequestGraph = {|
8483
invalidateOnBuildNodeIds: Set<NodeId>,
8584
|};
8685

87-
type FileNode = {|id: ContentKey, +type: 'file', value: InternalFile|};
86+
type FileNode = {|id: ContentKey, +type: 'file'|};
8887
type GlobNode = {|id: ContentKey, +type: 'glob', value: InternalGlob|};
8988
type FileNameNode = {|
9089
id: ContentKey,
@@ -167,7 +166,6 @@ export type StaticRunOpts<TResult> = {|
167166
const nodeFromFilePath = (filePath: ProjectPath): RequestGraphNode => ({
168167
id: fromProjectPathRelative(filePath),
169168
type: 'file',
170-
value: {filePath},
171169
});
172170

173171
const nodeFromGlob = (glob: InternalGlob): RequestGraphNode => ({
@@ -609,7 +607,7 @@ export class RequestGraph extends ContentGraph<
609607
let node = nullthrows(this.getNode(nodeId));
610608
switch (node.type) {
611609
case 'file':
612-
return {type: 'file', filePath: node.value.filePath};
610+
return {type: 'file', filePath: toProjectPathUnsafe(node.id)};
613611
case 'env':
614612
return {type: 'env', key: node.value.key};
615613
case 'option':
@@ -675,7 +673,7 @@ export class RequestGraph extends ContentGraph<
675673
requestGraphEdgeTypes.invalidated_by_create_above,
676674
) &&
677675
isDirectoryInside(
678-
fromProjectPathRelative(matchNode.value.filePath),
676+
fromProjectPathRelative(toProjectPathUnsafe(matchNode.id)),
679677
dirname,
680678
)
681679
) {

0 commit comments

Comments
 (0)