* Gets filename with info. * @param {NormalModule} module module for which the code should be generated * @param {Pick<AssetResourceGeneratorOptions, "filename" | "outputPath">} generatorOptions generator options * @param {{ runtime: RuntimeSpec, runtimeTemplate: RuntimeTemplate, chunkGraph: C
(
module,
generatorOptions,
{ runtime, runtimeTemplate, chunkGraph },
contentHash,
fullContentHash
)
| 293 | * @returns {{ filename: string, originalFilename: string, assetInfo: AssetInfo }} info |
| 294 | */ |
| 295 | static getFilenameWithInfo( |
| 296 | module, |
| 297 | generatorOptions, |
| 298 | { runtime, runtimeTemplate, chunkGraph }, |
| 299 | contentHash, |
| 300 | fullContentHash |
| 301 | ) { |
| 302 | const assetModuleFilename = |
| 303 | generatorOptions.filename || |
| 304 | runtimeTemplate.outputOptions.assetModuleFilename; |
| 305 | |
| 306 | const sourceFilename = AssetGenerator.getSourceFileName( |
| 307 | module, |
| 308 | runtimeTemplate |
| 309 | ); |
| 310 | let { path: filename, info: assetInfo } = |
| 311 | runtimeTemplate.compilation.getAssetPathWithInfo(assetModuleFilename, { |
| 312 | module, |
| 313 | runtime, |
| 314 | filename: sourceFilename, |
| 315 | chunkGraph, |
| 316 | contentHash, |
| 317 | contentHashFull: fullContentHash |
| 318 | }); |
| 319 | |
| 320 | const originalFilename = filename; |
| 321 | |
| 322 | if (generatorOptions.outputPath) { |
| 323 | const { path: outputPath, info } = |
| 324 | runtimeTemplate.compilation.getAssetPathWithInfo( |
| 325 | generatorOptions.outputPath, |
| 326 | { |
| 327 | module, |
| 328 | runtime, |
| 329 | filename: sourceFilename, |
| 330 | chunkGraph, |
| 331 | contentHash, |
| 332 | contentHashFull: fullContentHash |
| 333 | } |
| 334 | ); |
| 335 | filename = path.posix.join(outputPath, filename); |
| 336 | assetInfo = mergeAssetInfo(assetInfo, info); |
| 337 | } |
| 338 | |
| 339 | return { originalFilename, filename, assetInfo }; |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * Gets asset path with info. |
no test coverage detected