@@ -20,6 +20,7 @@ const fsWriteFile = promisify(fs.writeFile)
2020const fsCopyFile = promisify ( fs . copyFile )
2121
2222type ChunkGraphManifest = {
23+ sharedFiles : string [ ] | undefined
2324 pages : { [ page : string ] : string [ ] }
2425 pageChunks : { [ page : string ] : string [ ] }
2526 chunks : { [ page : string ] : string [ ] }
@@ -32,11 +33,12 @@ export class FlyingShuttle {
3233 private buildId : string
3334 private pagesDirectory : string
3435 private distDirectory : string
35- private cacheIdentifier : string
36+ private parentCacheIdentifier : string
3637
3738 private _shuttleBuildId : string | undefined
3839 private _restoreSema = new Sema ( 1 )
3940 private _recalledManifest : ChunkGraphManifest = {
41+ sharedFiles : [ ] ,
4042 pages : { } ,
4143 pageChunks : { } ,
4244 chunks : { } ,
@@ -65,7 +67,7 @@ export class FlyingShuttle {
6567 this . buildId = buildId
6668 this . pagesDirectory = pagesDirectory
6769 this . distDirectory = distDirectory
68- this . cacheIdentifier = cacheIdentifier
70+ this . parentCacheIdentifier = cacheIdentifier
6971 }
7072
7173 hasShuttle = async ( ) => {
@@ -100,9 +102,9 @@ export class FlyingShuttle {
100102 const manifestPath = path . join ( this . shuttleDirectory , CHUNK_GRAPH_MANIFEST )
101103 const manifest = require ( manifestPath ) as ChunkGraphManifest
102104
103- const { pages : pageFileDictionary , hashes } = manifest
105+ const { sharedFiles , pages : pageFileDictionary , hashes } = manifest
104106 const pageNames = Object . keys ( pageFileDictionary )
105- const allFiles = new Set ( )
107+ const allFiles = new Set ( sharedFiles )
106108 pageNames . forEach ( pageName =>
107109 pageFileDictionary [ pageName ] . forEach ( file => allFiles . add ( file ) )
108110 )
@@ -118,23 +120,28 @@ export class FlyingShuttle {
118120
119121 const hash = crypto
120122 . createHash ( 'sha1' )
121- . update ( this . cacheIdentifier )
123+ . update ( this . parentCacheIdentifier )
122124 . update ( await fsReadFile ( filePath ) )
123125 . digest ( 'hex' )
124126 fileChanged . set ( file , hash !== hashes [ file ] )
125127 } )
126128 )
127129
128- const unchangedPages = pageNames
129- . filter (
130- p => ! pageFileDictionary [ p ] . map ( f => fileChanged . get ( f ) ) . some ( Boolean )
131- )
132- . filter (
133- pageName =>
134- pageName !== '/_app' &&
135- pageName !== '/_error' &&
136- pageName !== '/_document'
137- )
130+ const unchangedPages = ( sharedFiles || [ ] )
131+ . map ( f => fileChanged . get ( f ) )
132+ . some ( Boolean )
133+ ? [ ]
134+ : pageNames
135+ . filter (
136+ p =>
137+ ! pageFileDictionary [ p ] . map ( f => fileChanged . get ( f ) ) . some ( Boolean )
138+ )
139+ . filter (
140+ pageName =>
141+ pageName !== '/_app' &&
142+ pageName !== '/_error' &&
143+ pageName !== '/_document'
144+ )
138145
139146 if ( unchangedPages . length ) {
140147 const u = unchangedPages . length
@@ -254,6 +261,8 @@ export class FlyingShuttle {
254261 ) as ChunkGraphManifest
255262
256263 const storeManifest : ChunkGraphManifest = {
264+ // Intentionally does not merge with the recalled manifest
265+ sharedFiles : nextManifest . sharedFiles ,
257266 pages : Object . assign (
258267 { } ,
259268 this . _recalledManifest . pages ,
0 commit comments