()
| 12 | // lacking what the precompiler imports, as arktype 2 lacks arktype/codecs, so |
| 13 | // each entry checks it before loading a module that imports arktype |
| 14 | export const checkArktypeVersion = (): void => { |
| 15 | for ( |
| 16 | let root = dirname(fileURLToPath(import.meta.resolve("arktype"))); |
| 17 | root !== dirname(root); |
| 18 | root = dirname(root) |
| 19 | ) { |
| 20 | const path = join(root, "package.json") |
| 21 | if (!existsSync(path)) continue |
| 22 | const { name, version, arkAotVersion } = parsePackageManifest( |
| 23 | readFileSync(path, "utf8"), |
| 24 | path |
| 25 | ) |
| 26 | if (name !== "arktype") continue |
| 27 | if (version === arktypeVersion) return |
| 28 | throwBuildError( |
| 29 | `arktype resolves to ${version}, but @ark/aot runs on ${arktypeVersion}\n ${version} at ${printablePathOf(process.cwd(), root)}, which @ark/aot imports\n ${version && arkAotVersion ? writeVersionHint(version, arkAotVersion) : writeArktypeHint(arktypeVersion)}` |
| 30 | ) |
| 31 | } |
| 32 | } |
no test coverage detected