(module: SourceModule)
| 7585 | } |
| 7586 | |
| 7587 | private checkConfiguration(module: SourceModule): Diagnostic[] { |
| 7588 | const result: Diagnostic[] = [] |
| 7589 | const calls = this.configureCallsOf(module) |
| 7590 | for (let i = 0; i < calls.length; i++) { |
| 7591 | const misplaced = |
| 7592 | !this.configures ? |
| 7593 | "configure() is called, but the build's `config` is false" |
| 7594 | : this.config === undefined ? |
| 7595 | "configure() is called, but the build has no `config` module" |
| 7596 | : this.config !== module.id ? |
| 7597 | `configure() is called outside the config module ${this.graph.pathOf(this.config)}` |
| 7598 | : i > 0 ? "configure() is called more than once" |
| 7599 | : undefined |
| 7600 | const { problem, reasons, hint } = |
| 7601 | misplaced ? |
| 7602 | { |
| 7603 | problem: misplaced, |
| 7604 | reasons: [], |
| 7605 | hint: |
| 7606 | !this.configures ? |
| 7607 | "Remove the call, or name its module as the build's `config`." |
| 7608 | : this.config === undefined ? writeNoConfigHint(module.path) |
| 7609 | : undefined |
| 7610 | } |
| 7611 | : (this.configuration ?? |
| 7612 | this.evaluateConfiguration( |
| 7613 | calls[i], |
| 7614 | module, |
| 7615 | this.importClosureOf(module.id) |
| 7616 | )) |
| 7617 | if (problem) { |
| 7618 | result.push( |
| 7619 | this.diagnostic(module, calls[i], "R3", problem, reasons, hint) |
| 7620 | ) |
| 7621 | } else if (this.mode === "standalone") |
| 7622 | result.push(...this.checkConfiguredOptions(module, calls[i])) |
| 7623 | } |
| 7624 | return result |
| 7625 | } |
| 7626 | |
| 7627 | // errors and mutatesInput configure() sets, reported once at the call |
| 7628 | private checkConfiguredOptions( |
no test coverage detected