MCPcopy Create free account
hub / github.com/arktypeio/arktype / checkConfiguration

Method checkConfiguration

ark/aot/precompile.ts:7587–7625  ·  view source on GitHub ↗
(module: SourceModule)

Source from the content-addressed store, hash-verified

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(

Callers 1

_analyzeMethod · 0.95

Calls 7

configureCallsOfMethod · 0.95
evaluateConfigurationMethod · 0.95
importClosureOfMethod · 0.95
diagnosticMethod · 0.95
pathOfMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected