///
///
import type { log } from './log';
import { CompressType } from './compress_type';
export interface FileRecord {
file: string;
body?: Buffer | string;
wasTransformed?: boolean;
[key: number]: any;
}
export type FileRecords = Record;
type License = string | {
type: string;
};
export type Patches = Record;
export type ConfigDictionary = Record;
};
dependencies?: Record;
}>;
export type PkgCompressType = Exclude;
export interface PkgOptions {
scripts?: string[];
log?: (logger: typeof log, context: Record) => void;
assets?: string[];
ignore?: string[];
/**
* Files that must be shipped next to the executable instead of bundled.
* Each entry is a tuple `[from, to]` or `[from, to, 'directory']` where
* `from` is the source path (relative to the package) and `to` is the
* destination path relative to the output binary.
*/
deployFiles?: Array<[string, string] | [string, string, 'directory']>;
patches?: Patches;
dictionary?: ConfigDictionary;
targets?: string | string[];
outputPath?: string;
compress?: PkgCompressType;
fallbackToSource?: boolean;
public?: boolean;
publicPackages?: string | string[];
options?: string | string[];
bytecode?: boolean;
nativeBuild?: boolean;
noDictionary?: string | string[];
debug?: boolean;
signature?: boolean;
sea?: boolean;
}
export interface PackageJson {
name?: string;
private?: boolean;
licenses?: License;
license?: License;
main?: string;
dependencies?: Record;
files?: string[];
pkg?: PkgOptions;
}
export declare const platform: {
macos: string;
win: string;
linux: string;
};
/**
* Canonical Node.js version string as produced by nodejs.org/dist and
* `process.version`: `v..`. Always v-prefixed —
* downstream consumers rely on the prefix to build archive filenames
* (`node-v22.22.2-linux-x64.tar.gz`) and to compare against
* `process.version`.
*/
export type NodeVersion = `v${number}.${number}.${number}`;
/**
* pkg's `nodeRange` format: `node` (e.g. `node22`,
* `node22.22.2`). Matches `NodeTarget.nodeRange` by convention.
*/
export type NodeRange = `node${string}`;
/** OS segment used in nodejs.org archive filenames. */
export declare const NODE_OSES: readonly ["darwin", "linux", "win"];
export type NodeOs = (typeof NODE_OSES)[number];
/** Arch segment used in nodejs.org archive filenames. */
export declare const NODE_ARCHS: readonly ["x64", "arm64", "armv7l", "ppc64", "s390x", "riscv64", "loong64"];
export type NodeArch = (typeof NODE_ARCHS)[number];
export interface NodeTarget {
nodeRange: string;
arch: string;
platform: keyof typeof platform;
forceBuild?: boolean;
}
export interface Target extends NodeTarget {
binaryPath: string;
output: string;
fabricator: Target;
}
export interface Marker {
hasDictionary?: boolean;
activated?: boolean;
toplevel?: boolean;
public?: boolean;
hasDeployFiles?: boolean;
config?: PackageJson;
configPath: string;
base: string;
}
export interface WalkerParams {
publicToplevel?: boolean;
publicPackages?: string[];
noDictionary?: string[];
seaMode?: boolean;
}
export interface SeaEnhancedOptions {
seaConfig?: {
disableExperimentalSEAWarning?: boolean;
useSnapshot?: boolean;
useCodeCache?: boolean;
};
signature?: boolean;
targets: (NodeTarget & Partial)[];
useLocalNode?: boolean;
nodePath?: string;
marker: Marker;
params: WalkerParams;
addition?: string;
doCompress?: CompressType;
}
export type SymLinks = Record;
export interface PkgExecOptions {
/** Entry file or directory (required). */
input: string;
/** Target specs, e.g. `['node22-linux-x64']` or `['host']`. */
targets?: string[];
/** Path to a `package.json` or standalone config JSON. */
config?: string;
/** Output file name or template for multiple targets. */
output?: string;
/** Directory to save the output executable(s). Mutually exclusive with `output`. */
outputPath?: string;
/** VFS compression algorithm. Default `'None'`. */
compress?: PkgCompressType;
/** Use Node.js Single Executable Application mode. */
sea?: boolean;
/** Bake Node/V8 CLI options into the executable (e.g. `['expose-gc']`). */
bakeOptions?: string | string[];
/** Enable verbose packaging logs. */
debug?: boolean;
/** Build base binaries from source instead of downloading prebuilt ones. */
build?: boolean;
/** Compile bytecode. Default `true`. Set to `false` to ship plain JS. */
bytecode?: boolean;
/** Build native addons. Default `true`. */
nativeBuild?: boolean;
/** If bytecode compilation fails for a file, ship it as plain source. */
fallbackToSource?: boolean;
/** Treat the top-level project as public (faster, discloses sources). */
public?: boolean;
/** Package names to treat as public. `['*']` for all packages. */
publicPackages?: string[];
/** Package names to ignore dictionaries for. `['*']` to disable all. */
noDictionary?: string[];
/** Sign macOS binaries when applicable. Default `true`. */
signature?: boolean;
}
export {};
//# sourceMappingURL=types.d.ts.map