( file, asset, assetInfo, options, compilation, cacheItem, registry )
| 169 | * @returns {SourceMapTask | undefined} created task instance or `undefined` |
| 170 | */ |
| 171 | const getTaskForFile = ( |
| 172 | file, |
| 173 | asset, |
| 174 | assetInfo, |
| 175 | options, |
| 176 | compilation, |
| 177 | cacheItem, |
| 178 | registry |
| 179 | ) => { |
| 180 | const extracted = extractSourceAndMap(file, asset, options, registry); |
| 181 | if (!extracted) return; |
| 182 | const { source, sourceMap, mapSource } = extracted; |
| 183 | const context = compilation.options.context; |
| 184 | const root = compilation.compiler.root; |
| 185 | const cachedAbsolutify = makePathsAbsolute.bindContextCache(context, root); |
| 186 | const modules = sourceMap.sources.map((source) => { |
| 187 | if (!source.startsWith("webpack://")) return source; |
| 188 | source = cachedAbsolutify(source.slice(10)); |
| 189 | const module = compilation.findModule(source); |
| 190 | return module || source; |
| 191 | }); |
| 192 | |
| 193 | return { |
| 194 | file, |
| 195 | source: /** @type {string} */ (source), |
| 196 | assetInfo, |
| 197 | sourceMap, |
| 198 | mapSource, |
| 199 | modules, |
| 200 | cacheItem |
| 201 | }; |
| 202 | }; |
| 203 | |
| 204 | const PLUGIN_NAME = "SourceMapDevToolPlugin"; |
| 205 |
no test coverage detected