MCPcopy
hub / github.com/webpack/webpack / source

Method source

lib/Module.js:1082–1110  ·  lib/Module.js::Module.source

* 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)

Source from the content-addressed store, hash-verified

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 /**

Callers 15

codeGenerationMethod · 0.95
applyMethod · 0.80
handleParseErrorMethod · 0.80
buildMethod · 0.80
extractSourceAndMapFunction · 0.80
getContentMethod · 0.80
applyMethod · 0.80
applyMethod · 0.80
applyMethod · 0.80
_analyseModuleMethod · 0.80
generateMethod · 0.80
applyMethod · 0.80

Calls 6

codeGenerationMethod · 0.95
getSourceTypesMethod · 0.95
firstFunction · 0.85
requireFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected