| 687 | // the read withPrecompile runs, under the options next.config gives the loader, |
| 688 | // as each loader process resolves them |
| 689 | export const readProjectWith = async ( |
| 690 | root: string, |
| 691 | config: NextConfigLike, |
| 692 | given?: PrecompilePluginOptions |
| 693 | ): Promise<{ |
| 694 | refused: string | undefined |
| 695 | warnings: string[] |
| 696 | opts: PrecompilePluginOptions |
| 697 | }> => { |
| 698 | const read = nextConfigReadOf(config, isOwnLoader) |
| 699 | const raw = given ?? ("options" in read ? read.options : {}) |
| 700 | const opts = resolvedOptionsOf( |
| 701 | withSettingsFile(raw.cwd !== undefined ? raw : { ...raw, cwd: root }), |
| 702 | true |
| 703 | ) |
| 704 | if (!readsWith(opts)) return { refused: undefined, warnings: [], opts } |
| 705 | const { refused, warnings } = await readProgram(root, opts, { |
| 706 | aliases: (config.turbopack?.resolveAlias ?? {}) as Record<string, unknown>, |
| 707 | problem: "problem" in read ? read.problem : babelProblemOf(root) |
| 708 | }) |
| 709 | return { refused, warnings, opts } |
| 710 | } |
| 711 | |
| 712 | const ownLoader = "@ark/aot/turbopack" |
| 713 | |