import { TargetConfiguration } from '@nx/devkit'; import { GoPluginOptions } from '../types/go-plugin-options'; /** * Name of the Nx named input (defined per-project in * `createNodesInternal`, and as a workspace-level fallback in nx.json by * `ensureGoSourceNamedInput`) that resolves to `GO_SOURCE_FILE_PATTERNS`. * * Targets reference dependency source via the `^goSource` form of this * name rather than inlining `GO_SOURCE_FILE_PATTERNS` with a `^` prefix, * because Nx resolves `^goSource` against *each dependency's own* * namedInputs (which may legitimately differ per project), not against the * consuming project's file patterns. */ export declare const GO_SOURCE_NAMED_INPUT = "goSource"; /** * File patterns that make up a Go project's compiled/analyzed source, for * both the project-local named input (`goSource`) and the cache `inputs` on * targets whose output depends on that source (build, lint, tidy, test, * generate). * * Go compiles, vets, and resolves module dependencies against the *source* * of every module it imports -- not just its own files. In a go.work or * replace-directive monorepo, an app can depend on a local library whose * source lives in another Nx project. If only the app's own files are * hashed, editing the library produces a stale cache hit for the app's * build/test/lint/tidy targets (see #217). * * `build`, `test`, `lint`, and `tidy` therefore hash `['goSource', * '^goSource']`: `^goSource` walks the project's Nx dependency graph and * hashes every dependency's `goSource` inputs too, transitively, so an * app -> lib1 -> lib2 chain invalidates correctly however deep it goes. * * `go.work`/`go.work.sum` are included at the workspace root because they * change module resolution for *every* Go project in the workspace, not * just the one that owns them; when the workspace doesn't use a Go * workspace file, these patterns simply match nothing. * * `generate` intentionally stays project-local (`['goSource']` only): its * go:generate directives only read the local module, and correctness * relative to dependencies is already handled by `dependsOn: ['^generate']` * rather than by cache-input hashing. */ export declare const GO_SOURCE_FILE_PATTERNS: string[]; /** * Builds the target table for a Go project. * * @param projectRoot The root path of the project * @param options The plugin options, used to resolve custom target names * @param isApplication Whether the project is an application (has a main * package) or a library. Callers must detect this themselves (see * `hasMainPackage`) and pass it in, rather than this function re-detecting * it, since detection does filesystem I/O and must run exactly once per * project. */ export declare function getTargetsByProjectType(projectRoot: string, options: GoPluginOptions, isApplication: boolean): Record;