001a3d1204
Removed stale per-version native cache directories after successful addon loads so updates do not leave old ~/.omp/natives/<version> trees behind. Added a focused loader regression test for keeping the current version directory and non-directory files while removing stale version folders. Fixes #2560
73 lines
1.9 KiB
TypeScript
73 lines
1.9 KiB
TypeScript
export interface EmbeddedAddonFile {
|
|
variant: "modern" | "baseline" | "default";
|
|
filename: string;
|
|
size?: number;
|
|
filePath?: string;
|
|
}
|
|
|
|
export interface EmbeddedAddonArchive {
|
|
format: "tar.gz";
|
|
filename: string;
|
|
filePath: string;
|
|
}
|
|
|
|
export interface EmbeddedAddon {
|
|
platformTag: string;
|
|
version: string;
|
|
files: EmbeddedAddonFile[];
|
|
archive?: EmbeddedAddonArchive;
|
|
}
|
|
|
|
export interface DetectCompiledBinaryInput {
|
|
embeddedAddon: EmbeddedAddon | null | undefined;
|
|
env: Record<string, string | undefined>;
|
|
importMetaUrl: string | null | undefined;
|
|
}
|
|
|
|
export function detectCompiledBinary(input: DetectCompiledBinaryInput): boolean;
|
|
|
|
export interface GetAddonFilenamesInput {
|
|
tag: string;
|
|
arch: string;
|
|
variant: "modern" | "baseline" | null | undefined;
|
|
}
|
|
|
|
export function getAddonFilenames(input: GetAddonFilenamesInput): string[];
|
|
|
|
export interface ShouldStageNodeModulesAddonInput {
|
|
platform: NodeJS.Platform | string;
|
|
isCompiledBinary: boolean;
|
|
nativeDir: string;
|
|
}
|
|
|
|
export function shouldStageNodeModulesAddon(input: ShouldStageNodeModulesAddonInput): boolean;
|
|
|
|
export interface ResolveLoaderCandidatesInput {
|
|
addonFilenames: string[];
|
|
isCompiledBinary: boolean;
|
|
stageFromNodeModules?: boolean;
|
|
nativeDir: string;
|
|
leafPackageDir?: string | null;
|
|
execDir: string;
|
|
versionedDir: string;
|
|
userDataDir: string;
|
|
}
|
|
|
|
export function resolveLoaderCandidates(input: ResolveLoaderCandidatesInput): string[];
|
|
|
|
export interface CleanupStaleNativeVersionsInput {
|
|
nativesDir: string;
|
|
currentVersion: string;
|
|
}
|
|
|
|
export function cleanupStaleNativeVersions(input: CleanupStaleNativeVersionsInput): string[];
|
|
|
|
export interface ExtractEmbeddedAddonArchiveInput {
|
|
archivePath: string;
|
|
files: EmbeddedAddonFile[];
|
|
targetDir: string;
|
|
}
|
|
|
|
export function extractEmbeddedAddonArchive(input: ExtractEmbeddedAddonArchiveInput): string[];
|
|
export function loadNative(): Record<string, unknown>;
|