File
Blob: types/src/utils.ts
| 1 | // Copyright (c) 2026 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | |
| 5 | import { existsSync } from "node:fs"; |
| 6 | import path from "node:path"; |
| 7 | |
| 8 | // When building types from the upstream repo all paths need to be prepended by |
| 9 | // external/+local_repository+workerd/ |
| 10 | export function getFilePath(f: string): string { |
| 11 | if (existsSync("external/+local_repository+workerd")) { |
| 12 | return path.join("external", "+local_repository+workerd", f); |
| 13 | } else { |
| 14 | return f; |
| 15 | } |
| 16 | } |