@@ -28,29 +28,25 @@ 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 ( serial . pipe (
43+ { freeze : serialJson . freeze , thaw : serial . identity . thaw } ,
44+ serialResolveRequest ,
45+ { freeze : serial . identity . freeze , thaw : serialJson . thaw } ,
46+ ) , serialResolved ) ;
47+
48+ const serialResourceHashMap = serial . map ( serial . request , serial . identity ) ;
49+
5450const serialNormalModule4 = serial . serial ( 'NormalModule' , {
5551 constructor : serial . constructed ( NormalModule , {
5652 data : serial . pipe (
@@ -166,6 +162,25 @@ const serialNormalModule4 = serial.serial('NormalModule', {
166162 _lastSuccessfulBuildMeta : serial . identity ,
167163
168164 __hardSource_resolved : serialResolvedMap ,
165+ __hardSource_oldHashes : serial . pipe (
166+ {
167+ freeze ( arg , module , extra ) {
168+ const obj = { } ;
169+ const cachedMd5s = compilation . __hardSourceCachedMd5s ;
170+
171+ for ( const file of module . buildInfo . fileDependencies ) {
172+ obj [ file ] = cachedHashes [ file ] ;
173+ }
174+ for ( const dir of module . buildInfo . contextDependencies ) {
175+ obj [ dir ] = cachedHashes [ dir ] ;
176+ }
177+
178+ return obj ;
179+ } ,
180+ thaw : serial . identity . thaw ,
181+ } ,
182+ serialResourceHashMap ,
183+ ) ,
169184 } ) ,
170185
171186 dependencyBlock : serial . dependencyBlock ,
@@ -200,7 +215,7 @@ const needRebuild4 = function() {
200215 return true ;
201216 }
202217 const fileHashes = this . __hardSourceFileMd5s ;
203- const cachedHashes = this . __hardSourceCachedMd5s ;
218+ const cachedHashes = this . __hardSource_oldHashes ;
204219 const resolvedLast = this . __hardSource_resolved ;
205220 const missingCache = this . __hardSource_missingCache ;
206221
@@ -348,6 +363,25 @@ const serialNormalModule3 = serial.serial('NormalModule', {
348363 _source : serial . source ,
349364
350365 __hardSource_resolved : serialResolvedMap ,
366+ __hardSource_oldHashes : serial . pipe (
367+ {
368+ freeze ( arg , module , extra ) {
369+ const obj = { } ;
370+ const cachedMd5s = extra . compilation . __hardSourceCachedMd5s ;
371+
372+ for ( const file of module . fileDependencies ) {
373+ obj [ file ] = cachedMd5s [ file ] ;
374+ }
375+ for ( const dir of module . contextDependencies ) {
376+ obj [ dir ] = cachedMd5s [ dir ] ;
377+ }
378+
379+ return obj ;
380+ } ,
381+ thaw : serial . identity . thaw ,
382+ } ,
383+ serialResourceHashMap ,
384+ ) ,
351385 } ) ,
352386
353387 hash : {
@@ -392,7 +426,7 @@ const needRebuild3 = function() {
392426 return true ;
393427 }
394428 const fileHashes = this . __hardSourceFileMd5s ;
395- const cachedHashes = this . __hardSourceCachedMd5s ;
429+ const cachedHashes = this . __hardSource_oldHashes ;
396430 const resolvedLast = this . __hardSource_resolved ;
397431 const missingCache = this . __hardSource_missingCache ;
398432
@@ -557,6 +591,7 @@ class TransformNormalModulePlugin {
557591 module . cacheItem . invalid = false ;
558592 module . cacheItem . invalidReason = null ;
559593 }
594+
560595 const f = serialNormalModule . freeze (
561596 null ,
562597 module ,
0 commit comments