import { LockfileRegistryPackage } from './lockfile-packages.js'; /** * The directory inside the code bundle where embedded package tarballs * live. This path is a contract with Checkly runners: tarballs found there * are served through a local registry during the bundle's install step. */ export declare const EMBEDDED_PACKAGES_ARCHIVE_DIR = ".checkly/embedded-packages"; export interface EmbeddedPackagesIssue { type: 'invalid-spec' | 'missing-lockfile' | 'unsupported-lockfile' | 'spec-not-found' | 'spec-version-not-found' | 'spec-not-embeddable'; /** The offending `bundle.packages.embed` entry, when tied to one. */ spec?: string; /** Standalone sentence describing the issue, usable on its own. */ message: string; /** * Entry-scoped detail for grouped diagnostics, phrased to follow the * entry under a per-type heading — e.g. the versions the lockfile does * have, or the reasons the matches cannot be embedded. */ detail?: string; } /** * One tarball selected for embedding, resolved from the lockfile. */ export interface PlannedTarball extends LockfileRegistryPackage { /** Archive filename, e.g. `@acme+foo@1.2.3.tgz` (scope slash → `+`). */ archiveFilename: string; } export interface EmbeddedPackagesPlan { tarballs: PlannedTarball[]; issues: EmbeddedPackagesIssue[]; /** * Non-fatal problems worth surfacing (e.g. a spec also matching * dependencies that cannot be embedded). Reported through the * diagnostics channel during project validation. */ warnings: string[]; /** * The lockfile the specs were resolved against, for diagnostics that * name it once instead of once per issue. Absent when resolution never * happened — no lockfile found, or an unsupported/unparsable one (the * corresponding lockfile issue explains it). */ lockfilePath?: string; } /** * A planned tarball that has been sourced into the CLI cache and is ready * to be added to the code bundle. */ export interface MaterializedTarball extends PlannedTarball { /** * SRI integrity the tarball was verified against — the lockfile's, or for * yarn.lock plans the one resolved from registry metadata. */ integrity: string; /** Absolute path of the verified tarball in the CLI cache. */ filePath: string; /** Bundle-root-relative archive path (POSIX). */ archivePath: string; } export declare class EmbeddedPackageError extends Error { constructor(message: string, options?: ErrorOptions); } export interface EmbeddedPackagesMaterializerOptions { /** Raw `bundle.packages.embed` entries. */ specs: string[]; /** Absolute path of the workspace root lockfile, when one exists. */ lockfilePath?: string; /** Workspace root directory, used to locate the root `.npmrc`. */ workspaceRoot?: string; /** * The directory the Checkly project lives in (a workspace member in a * monorepo), whose `.npmrc` takes precedence over the workspace root's. */ contextDir?: string; env?: NodeJS.ProcessEnv; homedir?: string; } /** * Resolves the configured `bundle.packages.embed` specs against the * workspace lockfile (plan) and sources the selected tarballs into the CLI * cache (materializeTarballs), through a chain of CLI cache → npm cacache → * registry download, always verified against the lockfile integrity. * * The plan memoizes its in-flight promise: validation and bundling share * one instance per parsed project, so the (purely local) resolution runs * exactly once. Materialization has a single caller — the Bundler, at * finalize time, after the bundled lockfile has been pruned — which passes * the subset of the plan the shipped lockfile still references, so * pruned-away tarballs are never downloaded. */ export declare class EmbeddedPackagesMaterializer { #private; constructor(options: EmbeddedPackagesMaterializerOptions); plan(): Promise; /** * Sources the given subset of the planned tarballs (CLI cache → npm * cacache → registry download, verified against the lockfile integrity). * Lets the caller materialize only the tarballs a pruned bundled lockfile * still references, so pruned-away packages are never downloaded. */ materializeTarballs(tarballs: PlannedTarball[]): Promise; }