MCPcopy
hub / github.com/webpack/webpack / mergeGlobalOptions

Function mergeGlobalOptions

lib/NormalModuleFactory.js:212–231  ·  view source on GitHub ↗
(globalOptions, type, localOptions)

Source from the content-addressed store, hash-verified

210 * @returns {T & O | T | O} result
211 */
212const mergeGlobalOptions = (globalOptions, type, localOptions) => {
213 const parts = type.split("/");
214 /** @type {undefined | T} */
215 let result;
216 let current = "";
217 for (const part of parts) {
218 current = current ? `${current}/${part}` : part;
219 const options =
220 /** @type {T} */
221 (globalOptions[/** @type {keyof T} */ (current)]);
222 if (typeof options === "object") {
223 result =
224 result === undefined ? options : cachedCleverMerge(result, options);
225 }
226 }
227 if (result === undefined) {
228 return localOptions;
229 }
230 return cachedCleverMerge(result, localOptions);
231};
232
233// TODO webpack 6 remove
234/**

Callers 2

createParserMethod · 0.85
createGeneratorMethod · 0.85

Calls 2

cachedCleverMergeFunction · 0.85
splitMethod · 0.80

Tested by

no test coverage detected