/** * demand-dependency-extractors — pure parse-only dependency-name extractors * for ecosystem manifests (#435). * * Extracted from demand-signals.ts so the extraction helpers (Cargo, Go, * Maven/Gradle, NuGet, Gem, Composer, Swift, Pubspec, PyProject/Poetry, * requirements) live apart from signal definitions and file classification. * Every function here is a pure string parser: no I/O, no signal mutation. */ export declare const YAML_DEPENDENCY_SECTION_NAMES: Set; /** * Parses a JSON string, returning null for empty or invalid input. */ export declare function parseJsonOrNull(content: string | null): T | null; /** * Deduplicates string values while preserving first-occurrence order. */ export declare function uniqueStrings(values: string[]): string[]; /** * Returns true when any needle occurs in the haystack. */ export declare function containsAnyText(haystack: string, needles: string[]): boolean; /** * Returns capture group `groupIndex` from a regular expression match, or * throws with a descriptive error when the match is absent or the group is * optional in the pattern. * * This is the #433 guarded-lookup shape applied to regex extraction: the * legacy extractors asserted `match[groupIndex]!` on mandatory groups — * provably safe, but a non-null assertion. The throw arms are unreachable * through the extractors (every caller checks the match first and every * pattern guarantees the group); they are covered directly by the * internals test suite. */ export declare function requiredCaptureGroup(match: RegExpMatchArray | RegExpExecArray | null, groupIndex: number, label: string, pattern?: RegExp): string; /** * Walks the lines of a sectioned config file (TOML `[section]` headers, * YAML `name:` headers, ...), yielding every line with the section that was * current BEFORE the line was processed. * * The legacy cargo/pyproject/pubspec extractors duplicated this walk * verbatim (review DRY finding); a single iterator keeps section tracking, * comment stripping, and header detection in one place. Headers are YIELDED * (with `isHeader: true`) so callers can reset per-section state — every * caller's original loop `continue`d on headers anyway. * * Line cleaning strips trailing inline comments by default * (`stripInlineComments: false` preserves raw lines — YAML indentation * matters), and `requireUnindentedHeader` restricts header detection to * column-0 headers (YAML section markers). */ export declare function walkSectionedLines(content: string, sectionHeaderPattern: RegExp, options?: { stripInlineComments?: boolean; requireUnindentedHeader?: boolean; }): Generator<{ section: string; line: string; rawLine: string; isHeader: boolean; }>; /** * Extracts dependency names from Cargo.toml dependency sections * (`[dependencies]`, `[dev-dependencies]`, `[build-dependencies]`, * `[workspace.dependencies]`, and target-scoped variants), filtering the * literal `package` key and deduplicating the result. */ export declare function extractCargoDependencyNames(content: string): string[]; /** * Returns whether a Cargo.toml section name is a dependency section. */ export declare function isCargoDependencySection(sectionName: string): boolean; /** * Extracts module paths from a Go module file (single-module `require` * lines and block bodies), deduplicating the result. */ export declare function extractGoModuleDependencyNames(content: string): string[]; /** * Extracts Maven `groupId:artifactId` pairs from pom.xml dependency blocks * and from Gradle configuration dependency declarations. */ export declare function extractMavenDependencyNames(content: string): string[]; /** * Extracts package names from NuGet package references (PackageReference / * PackageVersion / packages.config package entries). */ export declare function extractNugetDependencyNames(content: string): string[]; /** * Extracts gem names from Gemfile gem declarations. */ export declare function extractGemDependencyNames(content: string): string[]; /** * Extracts dependency names from composer.json `require` and `require-dev`, * filtering the literal `php` key. */ export declare function extractComposerDependencyNames(content: string): string[]; /** * Extracts the repository URLs of Swift Package Manager `.package` entries. */ export declare function extractSwiftDependencyNames(content: string): string[]; /** * Extracts dependency names from pyproject.toml: PEP 621 `dependencies` * lists, `project.optional-dependencies` groups, and Poetry tool sections, * skipping direct references and non-package specifiers. */ export declare function extractPyProjectDependencyNames(content: string): string[]; /** * Extracts a single Poetry dependency name from a `name = spec` line inside * a Poetry dependency section, or null for non-dependency, python, direct * reference, or table-reference lines. */ export declare function extractPoetryDependencyName(line: string, currentSection: string): string | null; /** * Returns whether a Poetry dependency spec is a table reference (`{ ... }` * with path/git/url/file keys) or a direct VCS/URL reference. */ export declare function isPoetryTableReference(value: string): boolean; /** * Returns whether the section name is a Poetry dependency section. */ export declare function isPoetryDependencySection(currentSection: string): boolean; /** * Returns whether a line opens a pyproject dependency list for the current * section: `dependencies = [` under `[project]` or `name = [` under * `[project.optional-dependencies]`. */ export declare function isPyProjectDependencyListStart(line: string, currentSection: string): boolean; /** * Returns whether a requirements.txt line looks like a plain package * specifier (non-empty, not a comment/option, no URL or path prefix). */ export declare function isPlainRequirementLine(line: string): boolean; /** * Returns whether a dependency specifier is a direct reference (local path * or VCS/URL) rather than a plain package name. */ export declare function isPythonDirectReference(value: string): boolean; /** * Type guard for plain package names (alphanumeric, dot, underscore, * hyphen only). */ export declare function isPlainPackageName(value: string | undefined): value is string; /** * Extracts dependency package names from pubspec.yaml dependency sections * (dependencies/dev_dependencies/dependency_overrides/test_dependencies) * using indentation to distinguish nested specs. */ export declare function extractPubspecDependencyNames(content: string): string[];