* Report dependency errors and warnings. * @param {Module} module module to report from * @param {DependenciesBlock[]} blocks blocks to report from * @returns {boolean} true, when it has warnings or errors
(module, blocks)
| 3885 | * @returns {boolean} true, when it has warnings or errors |
| 3886 | */ |
| 3887 | reportDependencyErrorsAndWarnings(module, blocks) { |
| 3888 | let hasProblems = false; |
| 3889 | for (const block of blocks) { |
| 3890 | const dependencies = block.dependencies; |
| 3891 | |
| 3892 | for (const d of dependencies) { |
| 3893 | const warnings = d.getWarnings(this.moduleGraph); |
| 3894 | if (warnings) { |
| 3895 | for (const w of warnings) { |
| 3896 | // A consolidated dependency (e.g. CssIcssExportDependency) carries |
| 3897 | // per-item locations on the error itself; fall back to the |
| 3898 | // dependency loc for the usual one-loc-per-dependency case. |
| 3899 | const warning = new ModuleDependencyWarning( |
| 3900 | module, |
| 3901 | w, |
| 3902 | /** @type {EXPECTED_ANY} */ (w).loc || d.loc |
| 3903 | ); |
| 3904 | this.warnings.push(warning); |
| 3905 | hasProblems = true; |
| 3906 | } |
| 3907 | } |
| 3908 | const errors = d.getErrors(this.moduleGraph); |
| 3909 | if (errors) { |
| 3910 | for (const e of errors) { |
| 3911 | const error = new ModuleDependencyError( |
| 3912 | module, |
| 3913 | e, |
| 3914 | /** @type {EXPECTED_ANY} */ (e).loc || d.loc |
| 3915 | ); |
| 3916 | this.errors.push(error); |
| 3917 | hasProblems = true; |
| 3918 | } |
| 3919 | } |
| 3920 | } |
| 3921 | |
| 3922 | if (this.reportDependencyErrorsAndWarnings(module, block.blocks)) { |
| 3923 | hasProblems = true; |
| 3924 | } |
| 3925 | } |
| 3926 | return hasProblems; |
| 3927 | } |
| 3928 | |
| 3929 | /** |
| 3930 | * Generates code and runtime requirements for this module. |
no test coverage detected