platformPackager.d.ts 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { Arch, AsyncTaskManager, DebugLogger } from "builder-util";
  2. import { FileTransformer } from "builder-util/out/fs";
  3. import { AppInfo } from "./appInfo";
  4. import { GetFileMatchersOptions } from "./fileMatcher";
  5. import { AfterPackContext, CompressionLevel, Configuration, ElectronPlatformName, FileAssociation, Packager, PackagerOptions, Platform, PlatformSpecificBuildOptions, Target, TargetSpecificOptions } from "./index";
  6. export declare abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions> {
  7. readonly info: Packager;
  8. readonly platform: Platform;
  9. get packagerOptions(): PackagerOptions;
  10. get buildResourcesDir(): string;
  11. get projectDir(): string;
  12. get config(): Configuration;
  13. readonly platformSpecificBuildOptions: DC;
  14. get resourceList(): Promise<Array<string>>;
  15. private readonly _resourceList;
  16. readonly appInfo: AppInfo;
  17. protected constructor(info: Packager, platform: Platform);
  18. get compression(): CompressionLevel;
  19. get debugLogger(): DebugLogger;
  20. abstract get defaultTarget(): Array<string>;
  21. protected prepareAppInfo(appInfo: AppInfo): AppInfo;
  22. private static normalizePlatformSpecificBuildOptions;
  23. abstract createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void;
  24. protected getCscPassword(): string;
  25. protected getCscLink(extraEnvName?: string | null): string | null | undefined;
  26. protected doGetCscPassword(): string | null | undefined;
  27. protected computeAppOutDir(outDir: string, arch: Arch): string;
  28. dispatchArtifactCreated(file: string, target: Target | null, arch: Arch | null, safeArtifactName?: string | null): Promise<void>;
  29. pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<any>;
  30. protected packageInDistributableFormat(appOutDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): void;
  31. private static buildAsyncTargets;
  32. private getExtraFileMatchers;
  33. createGetFileMatchersOptions(outDir: string, arch: Arch, customBuildOptions: PlatformSpecificBuildOptions): GetFileMatchersOptions;
  34. protected doPack(outDir: string, appOutDir: string, platformName: ElectronPlatformName, arch: Arch, platformSpecificBuildOptions: DC, targets: Array<Target>, sign?: boolean, disableAsarIntegrity?: boolean): Promise<void>;
  35. protected doSignAfterPack(outDir: string, appOutDir: string, platformName: ElectronPlatformName, arch: Arch, platformSpecificBuildOptions: DC, targets: Array<Target>): Promise<void>;
  36. protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null;
  37. private copyAppFiles;
  38. protected signApp(packContext: AfterPackContext, isAsar: boolean): Promise<boolean>;
  39. getIconPath(): Promise<string | null>;
  40. private computeAsarOptions;
  41. getElectronSrcDir(dist: string): string;
  42. getElectronDestinationDir(appOutDir: string): string;
  43. getResourcesDir(appOutDir: string): string;
  44. getMacOsResourcesDir(appOutDir: string): string;
  45. private checkFileInPackage;
  46. private sanityCheckPackage;
  47. computeSafeArtifactName(suggestedName: string | null, ext: string, arch?: Arch | null, skipDefaultArch?: boolean, defaultArch?: string, safePattern?: string): string | null;
  48. expandArtifactNamePattern(targetSpecificOptions: TargetSpecificOptions | null | undefined, ext: string, arch?: Arch | null, defaultPattern?: string, skipDefaultArch?: boolean, defaultArch?: string): string;
  49. artifactPatternConfig(targetSpecificOptions: TargetSpecificOptions | null | undefined, defaultPattern: string | undefined): {
  50. isUserForced: boolean;
  51. pattern: string;
  52. };
  53. expandArtifactBeautyNamePattern(targetSpecificOptions: TargetSpecificOptions | null | undefined, ext: string, arch?: Arch | null): string;
  54. private computeArtifactName;
  55. expandMacro(pattern: string, arch?: string | null, extra?: any, isProductNameSanitized?: boolean): string;
  56. generateName2(ext: string | null, classifier: string | null | undefined, deployment: boolean): string;
  57. getTempFile(suffix: string): Promise<string>;
  58. get fileAssociations(): Array<FileAssociation>;
  59. getResource(custom: string | null | undefined, ...names: Array<string>): Promise<string | null>;
  60. get forceCodeSigning(): boolean;
  61. protected getOrConvertIcon(format: IconFormat): Promise<string | null>;
  62. getDefaultFrameworkIcon(): string | null;
  63. resolveIcon(sources: Array<string>, fallbackSources: Array<string>, outputFormat: IconFormat): Promise<Array<IconInfo>>;
  64. }
  65. export interface IconInfo {
  66. file: string;
  67. size: number;
  68. }
  69. export declare type IconFormat = "icns" | "ico" | "set";
  70. export declare function isSafeGithubName(name: string): boolean;
  71. export declare function computeSafeArtifactNameIfNeeded(suggestedName: string | null, safeNameProducer: () => string): string | null;
  72. export declare function normalizeExt(ext: string): string;
  73. export declare function resolveFunction<T>(executor: T | string, name: string): T;
  74. export declare function chooseNotNull(v1: string | null | undefined, v2: string | null | undefined): string | null | undefined;