| 68 | * syntax as tsconfig.json#paths |
| 69 | */ |
| 70 | export interface PathAliases { |
| 71 | /** |
| 72 | * Root directory for resolving relative paths in mappings. Defaults to the |
| 73 | * current working directory. |
| 74 | * |
| 75 | * @example |
| 76 | * ```ts |
| 77 | * { |
| 78 | * rootDir: '/project/src/graphql', |
| 79 | * mappings: { |
| 80 | * '@types': './types' // Will resolve to '/project/src/graphql/types' |
| 81 | * } |
| 82 | * } |
| 83 | * ``` |
| 84 | */ |
| 85 | rootDir?: string; |
| 86 | |
| 87 | /** |
| 88 | * A map of path aliases to their corresponding file system paths. Keys are |
| 89 | * the aliases used in import statements, values are the paths they resolve |
| 90 | * to. |
| 91 | * |
| 92 | * ## Supports two patterns: |
| 93 | * |
| 94 | * 1. Exact mapping: Maps a specific alias to a specific file |
| 95 | * `'@user': '/path/to/user.graphql'` |
| 96 | * |
| 97 | * 2. Wildcard mapping: Maps a prefix pattern to a directory pattern using '*' |
| 98 | * 2a. The '*' is replaced with the remainder of the import path |
| 99 | * `'@models/*': '/path/to/models/*'` |
| 100 | * 2b. Maps to a directory without wildcard expansion |
| 101 | * `'@types/*': '/path/to/types'` |
| 102 | * |
| 103 | * @example |
| 104 | * ```ts |
| 105 | * { |
| 106 | * mappings: { |
| 107 | * // Exact mapping |
| 108 | * '@schema': '/project/schema/main.graphql', |
| 109 | * |
| 110 | * // Wildcard mapping with expansion |
| 111 | * '@models/*': '/project/graphql/models/*', |
| 112 | * |
| 113 | * // Wildcard mapping without expansion |
| 114 | * '@types/*': '/project/graphql/types.graphql', |
| 115 | * |
| 116 | * // Relative paths (resolved against rootDir if specified) |
| 117 | * '@common': './common/types.graphql' |
| 118 | * } |
| 119 | * } |
| 120 | * ``` |
| 121 | * |
| 122 | * Import examples: |
| 123 | * - `#import User from "@schema"` → `/project/schema/main.graphql` |
| 124 | * - `#import User from "@models/user.graphql"` → `/project/graphql/models/user.graphql` |
| 125 | * - `#import User from "@types/user.graphql"` → `/project/graphql/types.graphql` |
| 126 | * - `#import User from "@common"` → Resolved relative to rootDir |
| 127 | */ |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…