* Returns generated source. * @abstract * @deprecated Use codeGeneration() instead * @param {DependencyTemplates} dependencyTemplates the dependency templates * @param {RuntimeTemplate} runtimeTemplate the runtime template * @param {SourceType=} type the type of source that should be gener
(dependencyTemplates, runtimeTemplate, type = JAVASCRIPT_TYPE)
| 1080 | * @returns {Source} generated source |
| 1081 | */ |
| 1082 | source(dependencyTemplates, runtimeTemplate, type = JAVASCRIPT_TYPE) { |
| 1083 | if (this.codeGeneration === Module.prototype.codeGeneration) { |
| 1084 | const AbstractMethodError = require(class="st">"./errors/AbstractMethodError"); |
| 1085 | |
| 1086 | throw new AbstractMethodError(); |
| 1087 | } |
| 1088 | const chunkGraph = ChunkGraph.getChunkGraphForModule( |
| 1089 | this, |
| 1090 | class="st">"Module.source() is deprecated. Use Compilation.codeGenerationResults.getSource(module, runtime, type) instead", |
| 1091 | class="st">"DEP_WEBPACK_MODULE_SOURCE" |
| 1092 | ); |
| 1093 | /** @type {CodeGenerationContext} */ |
| 1094 | const codeGenContext = { |
| 1095 | dependencyTemplates, |
| 1096 | runtimeTemplate, |
| 1097 | moduleGraph: chunkGraph.moduleGraph, |
| 1098 | chunkGraph, |
| 1099 | runtime: undefined, |
| 1100 | runtimes: [], |
| 1101 | codeGenerationResults: undefined |
| 1102 | }; |
| 1103 | const sources = this.codeGeneration(codeGenContext).sources; |
| 1104 | |
| 1105 | return /** @type {Source} */ ( |
| 1106 | type |
| 1107 | ? sources.get(type) |
| 1108 | : sources.get(/** @type {SourceType} */ (first(this.getSourceTypes()))) |
| 1109 | ); |
| 1110 | } |
| 1111 | |
| 1112 | /* istanbul ignore next */ |
| 1113 | /** |
no test coverage detected