()
| 3834 | } |
| 3835 | |
| 3836 | private applyConfiguration(): Configuration { |
| 3837 | const { module, modules, call, version, files } = this.readConfiguration() |
| 3838 | const applied = threadConfiguration |
| 3839 | if (applied && applied.version === version) return applied |
| 3840 | if (holdsOtherConfiguration(files)) throwError(configuredThreadMessage) |
| 3841 | const evaluated = |
| 3842 | module && call && this.evaluateConfiguration(call, module, modules) |
| 3843 | const problem = |
| 3844 | evaluated && |
| 3845 | (evaluated.problem ?? |
| 3846 | // configure() would throw after the first Type |
| 3847 | (!applied && $ark.cfg ? |
| 3848 | "configure() is called after its argument creates a Type" |
| 3849 | : undefined)) |
| 3850 | const configuration: Configuration = { |
| 3851 | modules, |
| 3852 | version, |
| 3853 | files, |
| 3854 | fingerprint: |
| 3855 | evaluated && !problem ? |
| 3856 | fingerprintOf(evaluated.value ?? {}) |
| 3857 | : undefined, |
| 3858 | problem, |
| 3859 | reasons: evaluated ? evaluated.reasons : [], |
| 3860 | hint: evaluated?.hint |
| 3861 | } |
| 3862 | if (applied) { |
| 3863 | // e.g. the config module transpiled by an earlier plugin |
| 3864 | return problem || configuration.fingerprint === applied.fingerprint ? |
| 3865 | configuration |
| 3866 | : { |
| 3867 | ...configuration, |
| 3868 | fingerprint: undefined, |
| 3869 | problem: configurationConflictMessage, |
| 3870 | reasons: [configurationConflictReason], |
| 3871 | hint: writeConflictHint(this.graph.pathOf(this.config!)) |
| 3872 | } |
| 3873 | } |
| 3874 | if (evaluated) { |
| 3875 | if (!problem) { |
| 3876 | configuration.interpreter = this.interpreter |
| 3877 | configure(evaluated.value as never) |
| 3878 | } |
| 3879 | threadConfiguration = configuration |
| 3880 | } |
| 3881 | // so a later configure() throws, as after the first Type |
| 3882 | void ark.internal.cfg |
| 3883 | return configuration |
| 3884 | } |
| 3885 | |
| 3886 | // keeps the shared thread configuration's writer interpreter on the active |
| 3887 | // stack when a replacement Precompiler runs sites under its writers |
no test coverage detected