import archiver from 'archiver'; import { WorkspaceMapping, FileDependencyMapping } from '@hubspot/project-parsing-lib/workspaces'; /** * Result of archiving workspaces and file dependencies */ export type WorkspaceArchiveResult = { packageWorkspaces: Map; packageFileDeps: Map>; }; /** * Generates a short hash of the input string for use in workspace paths. * Uses SHA256 truncated to 8 hex characters (4 billion possibilities). */ export declare function shortHash(input: string): string; /** * Converts native path separators to POSIX forward slashes. * * Zip entry names and npm workspace globs are POSIX-only. On Windows, * `path.relative` returns backslash-separated paths; archiver normalizes * its appended entry names to forward slashes but its filter callback * receives forward-slashed names too. Without this normalization, lookups * in our exclusion Sets miss on Windows and a file gets archived twice. */ export declare function toPosixPath(p: string): string; /** * Determines the archive path for an external workspace or file: dependency. * Produces `_workspaces/-` with no subdirectory. * The hash prevents collisions between different directories with the same basename. */ export declare function computeExternalArchivePath(absolutePath: string): string; /** * Updates package.json files in the archive to reflect new workspace and file: dependency paths. * * Workspace entries in packageWorkspaces are already in final form: * - Internal workspaces: relative paths (e.g. "../packages/utils") * - External workspaces: relative paths (e.g. "../_workspaces/logger-abc") * * Only external file: dependencies appear in packageFileDeps; internal ones * keep their original file: references and are left untouched. */ export declare function updatePackageJsonInArchive(archive: archiver.Archiver, srcDir: string, packageWorkspaces: Map, packageFileDeps: Map>): Promise; export declare function rewriteLockfileForExternalDeps(lockfileContent: Record, pathMappings: Array<{ oldPath: string; newPath: string; }>): Record; export declare function getPackageJsonPathsToUpdate(srcDir: string, workspaceMappings: WorkspaceMapping[], fileDependencyMappings: FileDependencyMapping[]): Set; export declare function getLockfilePathsToUpdate(srcDir: string, workspaceMappings: WorkspaceMapping[], fileDependencyMappings: FileDependencyMapping[]): Set; /** * Main orchestration function that handles archiving of workspaces and file dependencies. * This is the clean integration point for upload.ts. */ export declare function archiveWorkspacesAndDependencies(archive: archiver.Archiver, srcDir: string, workspaceMappings: WorkspaceMapping[], fileDependencyMappings: FileDependencyMapping[]): Promise;