bfd043b3e4
- Added `leafPackageDir` to loader state types and context for platform-native package roots. - Updated `resolveLoaderCandidates` to include `leafPackageDir` in addon candidate search paths. - Adjusted `maybeStageNodeModulesAddon` to stage addons from `ctx.leafPackageDir` before falling back to `nativeDir`.
66 lines
1.7 KiB
TypeScript
66 lines
1.7 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 ExtractEmbeddedAddonArchiveInput {
|
|
archivePath: string;
|
|
files: EmbeddedAddonFile[];
|
|
targetDir: string;
|
|
}
|
|
|
|
export function extractEmbeddedAddonArchive(input: ExtractEmbeddedAddonArchiveInput): string[];
|
|
export function loadNative(): Record<string, unknown>;
|