@@ -28,29 +28,25 @@ const serialResolved = serial.created({
28
28
// loaders: serial.loaders,
29
29
} ) ;
30
30
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 ) ;
42
34
} ,
43
35
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 ) ;
51
37
} ,
52
38
} ;
53
39
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
+
54
50
const serialNormalModule4 = serial . serial ( 'NormalModule' , {
55
51
constructor : serial . constructed ( NormalModule , {
56
52
data : serial . pipe (
@@ -166,6 +162,25 @@ const serialNormalModule4 = serial.serial('NormalModule', {
166
162
_lastSuccessfulBuildMeta : serial . identity ,
167
163
168
164
__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
+ ) ,
169
184
} ) ,
170
185
171
186
dependencyBlock : serial . dependencyBlock ,
@@ -200,7 +215,7 @@ const needRebuild4 = function() {
200
215
return true ;
201
216
}
202
217
const fileHashes = this . __hardSourceFileMd5s ;
203
- const cachedHashes = this . __hardSourceCachedMd5s ;
218
+ const cachedHashes = this . __hardSource_oldHashes ;
204
219
const resolvedLast = this . __hardSource_resolved ;
205
220
const missingCache = this . __hardSource_missingCache ;
206
221
@@ -348,6 +363,25 @@ const serialNormalModule3 = serial.serial('NormalModule', {
348
363
_source : serial . source ,
349
364
350
365
__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
+ ) ,
351
385
} ) ,
352
386
353
387
hash : {
@@ -392,7 +426,7 @@ const needRebuild3 = function() {
392
426
return true ;
393
427
}
394
428
const fileHashes = this . __hardSourceFileMd5s ;
395
- const cachedHashes = this . __hardSourceCachedMd5s ;
429
+ const cachedHashes = this . __hardSource_oldHashes ;
396
430
const resolvedLast = this . __hardSource_resolved ;
397
431
const missingCache = this . __hardSource_missingCache ;
398
432
@@ -557,6 +591,7 @@ class TransformNormalModulePlugin {
557
591
module . cacheItem . invalid = false ;
558
592
module . cacheItem . invalidReason = null ;
559
593
}
594
+
560
595
const f = serialNormalModule . freeze (
561
596
null ,
562
597
module ,
0 commit comments