/** * @file Package manifest and packument fetching utilities. */ import type { PackageJson, PacoteOptions } from './types.js'; /** * Create a package.json object for a Socket registry package. * * @example * ;```typescript * const pkgJson = createPackageJson('is-number', 'packages/npm/is-number', { * version: '1.0.0', * description: 'Check if a value is a number', * }) * ``` */ export declare function createPackageJson(sockRegPkgName: string, directory: string, options?: PackageJson | undefined): PackageJson; /** * Fetch the manifest for a package. * * @example * ;```typescript * const manifest = await fetchPackageManifest('lodash@4.17.21') * ``` */ export declare function fetchPackageManifest(pkgNameOrId: string, options?: PacoteOptions | undefined): Promise; /** * Fetch the packument, the package document, for a package. * * @example * ;```typescript * const packument = await fetchPackagePackument('lodash') * ``` */ export declare function fetchPackagePackument(pkgNameOrId: string, options?: PacoteOptions | undefined): Promise; /** * Dev/build-only top-level package.json fields not needed at runtime. The * conservative default for {@link trimPublishManifest}; extend per-package via * its `drop` option. */ export declare const DEFAULT_TRIM_FIELDS: readonly string[]; export interface TrimPublishManifestOptions { /** * Top-level fields to omit (defaults to {@link DEFAULT_TRIM_FIELDS}). */ readonly drop?: readonly string[] | undefined; /** * Fields to KEEP even when listed in `drop` (e.g. a runtime postinstall). */ readonly keep?: readonly string[] | undefined; } /** * Return a shallow copy of `manifest` that omits dev/build-only top-level * fields so a published tarball + its npm metadata stay lean (npm caps total * per-package metadata at 100 MB). The original object is left intact; persist * the result only for the publish, never over the repo's own package.json. * * @example * ;```typescript * const lean = trimPublishManifest(pkg) // omits devDependencies + scripts * const kept = trimPublishManifest(pkg, { keep: ['scripts'] }) * ``` */ export declare function trimPublishManifest(manifest: PackageJson, options?: TrimPublishManifestOptions | undefined): PackageJson;