(cwd: string)
| 60 | |
| 61 | // ark.json, or the package.json whose "ark" key holds the same settings |
| 62 | export const settingsFileOf = (cwd: string): string | undefined => { |
| 63 | for (let dir = realPathOf(cwd); ; dir = dirname(dir)) { |
| 64 | const manifest = join(dir, "package.json") |
| 65 | if (existsSync(manifest)) { |
| 66 | const path = join(dir, settingsFile) |
| 67 | const { ark } = readJson(manifest) as { ark?: unknown } |
| 68 | if (!existsSync(path)) return ark === undefined ? undefined : manifest |
| 69 | // a library's "aot" is for its consumers, so it may build with ark.json |
| 70 | if (ark !== undefined) { |
| 71 | validated(validators.PackageArk, ark, `${manifest}: ark.`) |
| 72 | if ((ark as { precompile?: unknown }).precompile !== undefined) |
| 73 | throw new Error(writeSettingsConflictMessage(manifest, path)) |
| 74 | } |
| 75 | return path |
| 76 | } |
| 77 | if (dirname(dir) === dir) return |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | const readSettingsFile = (path: string): PrecompilePluginOptions => { |
| 82 | const json = readJson(path) |
no test coverage detected