MCPcopy
hub / github.com/webpack/webpack / exec

Method exec

lib/DefinePlugin.js:85–125  ·  lib/DefinePlugin.js::RuntimeValue.exec

* Returns code. * @param {JavascriptParser} parser the parser * @param {ValueCacheVersions} valueCacheVersions valueCacheVersions * @param {string} key the defined key * @returns {CodeValuePrimitive} code

(parser, valueCacheVersions, key)

Source from the content-addressed store, hash-verified

83 * @returns {CodeValuePrimitive} code
84 */
85 exec(parser, valueCacheVersions, key) {
86 const buildInfo = /** @type {BuildInfo} */ (parser.state.module.buildInfo);
87 if (this.options === true) {
88 buildInfo.cacheable = false;
89 } else {
90 if (this.options.fileDependencies) {
91 for (const dep of this.options.fileDependencies) {
92 /** @type {NonNullable<BuildInfo[class="st">"fileDependencies"]>} */
93 (buildInfo.fileDependencies).add(dep);
94 }
95 }
96 if (this.options.contextDependencies) {
97 for (const dep of this.options.contextDependencies) {
98 /** @type {NonNullable<BuildInfo[class="st">"contextDependencies"]>} */
99 (buildInfo.contextDependencies).add(dep);
100 }
101 }
102 if (this.options.missingDependencies) {
103 for (const dep of this.options.missingDependencies) {
104 /** @type {NonNullable<BuildInfo[class="st">"missingDependencies"]>} */
105 (buildInfo.missingDependencies).add(dep);
106 }
107 }
108 if (this.options.buildDependencies) {
109 for (const dep of this.options.buildDependencies) {
110 /** @type {NonNullable<BuildInfo[class="st">"buildDependencies"]>} */
111 (buildInfo.buildDependencies).add(dep);
112 }
113 }
114 }
115
116 return this.fn({
117 module: parser.state.module,
118 key,
119 get version() {
120 return /** @type {ValueCacheVersion} */ (
121 valueCacheVersions.get(VALUE_DEP_PREFIX + key)
122 );
123 }
124 });
125 }
126
127 getCacheVersion() {
128 return this.options === true

Callers 15

transformToCodeFunction · 0.80
checkManagedMethod · 0.80
_readContextMethod · 0.80
_createLoaderContextMethod · 0.80
parseFunction · 0.80
expandValueFunction · 0.80
constructorMethod · 0.80
matchModuleReferenceMethod · 0.80
getPresentKindsFunction · 0.80

Calls 2

addMethod · 0.45
fnMethod · 0.45

Tested by

no test coverage detected