File tree 2 files changed +8
-6
lines changed
packages/workspace/src/core
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -219,8 +219,7 @@ export function readWorkspaceFiles(): FileData[] {
219
219
220
220
if ( defaultFileHasher . usesGitForHashing ) {
221
221
const ignoredGlobs = getIgnoredGlobs ( ) ;
222
- const r = defaultFileHasher
223
- . allFiles ( )
222
+ const r = defaultFileHasher . workspaceFiles
224
223
. filter ( ( f ) => ! ignoredGlobs . ignores ( f ) )
225
224
. map ( ( f ) => getFileData ( `${ appRootPath } /${ f } ` ) ) ;
226
225
performance . mark ( 'read workspace files:end' ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export function extractNameAndVersion(content: string): string {
20
20
21
21
export class FileHasher {
22
22
fileHashes : { [ path : string ] : string } = { } ;
23
+ workspaceFiles = [ ] ;
23
24
usesGitForHashing = false ;
24
25
25
26
constructor ( private readonly hashing : HashingImp ) {
@@ -29,6 +30,7 @@ export class FileHasher {
29
30
init ( ) {
30
31
performance . mark ( 'init hashing:start' ) ;
31
32
this . fileHashes = { } ;
33
+ this . workspaceFiles = [ ] ;
32
34
this . getHashesFromGit ( ) ;
33
35
this . usesGitForHashing = Object . keys ( this . fileHashes ) . length > 0 ;
34
36
performance . mark ( 'init hashing:end' ) ;
@@ -49,14 +51,15 @@ export class FileHasher {
49
51
return this . fileHashes [ relativePath ] ;
50
52
}
51
53
52
- allFiles ( ) {
53
- return Object . keys ( this . fileHashes ) ;
54
- }
55
-
56
54
private getHashesFromGit ( ) {
57
55
const sliceIndex = appRootPath . length + 1 ;
58
56
getFileHashes ( appRootPath ) . forEach ( ( hash , filename ) => {
59
57
this . fileHashes [ filename . substr ( sliceIndex ) ] = hash ;
58
+ /**
59
+ * we have to store it separately because fileHashes can be modified
60
+ * later on and can contain files that do not exist in the workspace
61
+ */
62
+ this . workspaceFiles . push ( filename . substr ( sliceIndex ) ) ;
60
63
} ) ;
61
64
}
62
65
You can’t perform that action at this time.
0 commit comments