@@ -207,10 +207,7 @@ class ScriptTransformer {
207
207
) ;
208
208
}
209
209
210
- private _createFolderFromCacheKey (
211
- filename : string ,
212
- cacheKey : string ,
213
- ) : string {
210
+ private _createCachedFilename ( filename : string , cacheKey : string ) : string {
214
211
const HasteMapClass = HasteMap . getStatic ( this . _config ) ;
215
212
const baseCacheDir = HasteMapClass . getCacheFilePath (
216
213
this . _config . cacheDirectory ,
@@ -223,12 +220,7 @@ class ScriptTransformer {
223
220
const cacheFilenamePrefix = path
224
221
. basename ( filename , path . extname ( filename ) )
225
222
. replace ( / \W / g, '' ) ;
226
- const cachePath = slash (
227
- path . join ( cacheDir , `${ cacheFilenamePrefix } _${ cacheKey } ` ) ,
228
- ) ;
229
- createDirectory ( cacheDir ) ;
230
-
231
- return cachePath ;
223
+ return slash ( path . join ( cacheDir , `${ cacheFilenamePrefix } _${ cacheKey } ` ) ) ;
232
224
}
233
225
234
226
private _getFileCachePath (
@@ -238,7 +230,7 @@ class ScriptTransformer {
238
230
) : string {
239
231
const cacheKey = this . _getCacheKey ( content , filename , options ) ;
240
232
241
- return this . _createFolderFromCacheKey ( filename , cacheKey ) ;
233
+ return this . _createCachedFilename ( filename , cacheKey ) ;
242
234
}
243
235
244
236
private async _getFileCachePathAsync (
@@ -248,7 +240,7 @@ class ScriptTransformer {
248
240
) : Promise < string > {
249
241
const cacheKey = await this . _getCacheKeyAsync ( content , filename , options ) ;
250
242
251
- return this . _createFolderFromCacheKey ( filename , cacheKey ) ;
243
+ return this . _createCachedFilename ( filename , cacheKey ) ;
252
244
}
253
245
254
246
private _getTransformPath ( filename : string ) {
@@ -504,6 +496,7 @@ class ScriptTransformer {
504
496
} ) ;
505
497
}
506
498
499
+ createDirectory ( path . dirname ( cacheFilePath ) ) ;
507
500
return this . _buildTransformResult (
508
501
filename ,
509
502
cacheFilePath ,
@@ -568,6 +561,7 @@ class ScriptTransformer {
568
561
} ) ;
569
562
}
570
563
564
+ createDirectory ( path . dirname ( cacheFilePath ) ) ;
571
565
return this . _buildTransformResult (
572
566
filename ,
573
567
cacheFilePath ,
0 commit comments