@@ -28,29 +28,28 @@ const serialResolved = serial.created({
2828 // loaders: serial.loaders,
2929} ) ;
3030
31- const serialResolvedMap = {
32- freeze ( arg , module , extra ) {
33- const resolved = [ ] ;
34- for ( const key in arg ) {
35- const thawedKey = JSON . parse ( key ) ;
36- resolved . push ( [
37- serialResolveRequest . freeze ( thawedKey , thawedKey , extra ) ,
38- serialResolved . freeze ( arg [ key ] , arg [ key ] , extra ) ,
39- ] ) ;
40- }
41- return resolved ;
31+ const serialJson = {
32+ freeze ( arg , value , extra ) {
33+ return JSON . parse ( arg ) ;
4234 } ,
4335 thaw ( arg , frozen , extra ) {
44- const resolved = { } ;
45- for ( const item of arg ) {
46- const key = serialResolveRequest . thaw ( item [ 0 ] , item [ 0 ] , extra ) ;
47- const value = serialResolved . thaw ( item [ 1 ] , item [ 1 ] , extra ) ;
48- resolved [ JSON . stringify ( key ) ] = value ;
49- }
50- return resolved ;
36+ return JSON . stringify ( arg ) ;
5137 } ,
5238} ;
5339
40+ const serialMap = serial . map ;
41+
42+ const serialResolvedMap = serial . map (
43+ serial . pipe (
44+ { freeze : serialJson . freeze , thaw : serial . identity . thaw } ,
45+ serialResolveRequest ,
46+ { freeze : serial . identity . freeze , thaw : serialJson . thaw } ,
47+ ) ,
48+ serialResolved ,
49+ ) ;
50+
51+ const serialResourceHashMap = serial . map ( serial . request , serial . identity ) ;
52+
5453const serialNormalModule4 = serial . serial ( 'NormalModule' , {
5554 constructor : serial . constructed ( NormalModule , {
5655 data : serial . pipe (
@@ -166,6 +165,25 @@ const serialNormalModule4 = serial.serial('NormalModule', {
166165 _lastSuccessfulBuildMeta : serial . identity ,
167166
168167 __hardSource_resolved : serialResolvedMap ,
168+ __hardSource_oldHashes : serial . pipe (
169+ {
170+ freeze ( arg , module , extra ) {
171+ const obj = { } ;
172+ const cachedMd5s = compilation . __hardSourceCachedMd5s ;
173+
174+ for ( const file of module . buildInfo . fileDependencies ) {
175+ obj [ file ] = cachedHashes [ file ] ;
176+ }
177+ for ( const dir of module . buildInfo . contextDependencies ) {
178+ obj [ dir ] = cachedHashes [ dir ] ;
179+ }
180+
181+ return obj ;
182+ } ,
183+ thaw : serial . identity . thaw ,
184+ } ,
185+ serialResourceHashMap ,
186+ ) ,
169187 } ) ,
170188
171189 dependencyBlock : serial . dependencyBlock ,
@@ -200,7 +218,7 @@ const needRebuild4 = function() {
200218 return true ;
201219 }
202220 const fileHashes = this . __hardSourceFileMd5s ;
203- const cachedHashes = this . __hardSourceCachedMd5s ;
221+ const cachedHashes = this . __hardSource_oldHashes ;
204222 const resolvedLast = this . __hardSource_resolved ;
205223 const missingCache = this . __hardSource_missingCache ;
206224
@@ -348,6 +366,25 @@ const serialNormalModule3 = serial.serial('NormalModule', {
348366 _source : serial . source ,
349367
350368 __hardSource_resolved : serialResolvedMap ,
369+ __hardSource_oldHashes : serial . pipe (
370+ {
371+ freeze ( arg , module , extra ) {
372+ const obj = { } ;
373+ const cachedMd5s = extra . compilation . __hardSourceCachedMd5s ;
374+
375+ for ( const file of module . fileDependencies ) {
376+ obj [ file ] = cachedMd5s [ file ] ;
377+ }
378+ for ( const dir of module . contextDependencies ) {
379+ obj [ dir ] = cachedMd5s [ dir ] ;
380+ }
381+
382+ return obj ;
383+ } ,
384+ thaw : serial . identity . thaw ,
385+ } ,
386+ serialResourceHashMap ,
387+ ) ,
351388 } ) ,
352389
353390 hash : {
@@ -392,7 +429,7 @@ const needRebuild3 = function() {
392429 return true ;
393430 }
394431 const fileHashes = this . __hardSourceFileMd5s ;
395- const cachedHashes = this . __hardSourceCachedMd5s ;
432+ const cachedHashes = this . __hardSource_oldHashes ;
396433 const resolvedLast = this . __hardSource_resolved ;
397434 const missingCache = this . __hardSource_missingCache ;
398435
@@ -557,6 +594,7 @@ class TransformNormalModulePlugin {
557594 module . cacheItem . invalid = false ;
558595 module . cacheItem . invalidReason = null ;
559596 }
597+
560598 const f = serialNormalModule . freeze (
561599 null ,
562600 module ,
0 commit comments