(globalOptions, type, localOptions)
| 210 | * @returns {T & O | T | O} result |
| 211 | */ |
| 212 | const 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 | /** |
no test coverage detected