/** * Input pattern classification for source strings. * * Classifies raw input strings into typed `InputPattern` variants * (URL, SCP, shorthand, file path, etc.) for downstream routing * by `resolveSource`. * * @experimental This API is unstable and may change without notice. * @packageDocumentation */ import * as Option from "effect/Option"; import type { VersionRange } from "../version-constraints/version-constraints.js"; import type { ExtensionName, ExtensionType, ExtensionTypePlural, Handle } from "../extensions/index.js"; /** A simple name with no `/`, `@`, or URL scheme. */ type NameInput = { readonly pattern: "name-input"; readonly name: string; }; /** A namespaced registry source: `[source-name:]@owner//name`. */ type RegistryPatternInput = { readonly pattern: "registry-pattern-input"; readonly sourceName: string; readonly type: Option.Option; readonly owner: Handle; readonly name: Option.Option; readonly versionRange: Option.Option; }; /** A valid URL (validated via `Schema.URL`). */ type UrlInput = { readonly pattern: "url-input"; readonly url: URL; }; /** An SCP-style git address: `user@host:path` (e.g. `git@github.com:owner/repo.git`). */ type GitScpAddress = { readonly pattern: "git-scp-address"; readonly user: string; readonly host: string; readonly path: string; }; /** An `owner/repo[/path]` style pattern containing `/` (not a URL or file path). */ type SlashPattern = { readonly pattern: "slash-pattern"; readonly first: string; readonly second: string; readonly third: Option.Option; }; /** A local filesystem path matching `LOCAL_PATH_PATTERN`. */ type FilePathPattern = { readonly pattern: "file-path-pattern"; readonly path: string; }; /** A shorthand prefixed input: `:...` where prefix is a known source provider. */ export type ShorthandInput = { readonly pattern: "shorthand-input"; readonly prefix: string; readonly remainingInput: string; }; /** A glob pattern containing `*` wildcards (e.g. `effect-*`). */ type GlobInput = { readonly pattern: "glob-input"; readonly value: string; }; /** An intrinsic workspace package locator. */ type WorkspacePatternInput = { readonly pattern: "workspace-pattern-input"; readonly owner: Handle; readonly type: ExtensionType; readonly name: ExtensionName; }; /** Discriminated union of all input patterns recognized by the parser. */ export type InputPattern = NameInput | RegistryPatternInput | UrlInput | GitScpAddress | SlashPattern | FilePathPattern | ShorthandInput | GlobInput | WorkspacePatternInput; /** Parse result with the classified pattern and original input. */ export type InputParseResult = { readonly pattern: T; readonly originalInput: string; }; /** * Classify an input string into an InputPattern. * * Pure function — no effects, no trimming. Returns `None` for empty/whitespace-only input. */ export declare const parseInputPattern: (input: string) => Option.Option; export {}; //# sourceMappingURL=parser.d.ts.map