UNPKG

3.37 kBTypeScriptView Raw
1import { Arch, DebugLogger, TmpDir } from "builder-util";
2import { CancellationToken } from "builder-util-runtime";
3import { EventEmitter } from "events";
4import { Lazy } from "lazy-val";
5import { AppInfo } from "./appInfo";
6import { AfterPackContext, Configuration } from "./configuration";
7import { Platform, SourceRepositoryInfo, Target } from "./core";
8import { Framework } from "./Framework";
9import { Metadata } from "./options/metadata";
10import { ArtifactBuildStarted, ArtifactCreated, PackagerOptions } from "./packagerApi";
11import { PlatformPackager } from "./platformPackager";
12import { NodeModuleDirInfo, NodeModuleInfo } from "./util/packageDependencies";
13export declare class Packager {
14 readonly cancellationToken: CancellationToken;
15 readonly projectDir: string;
16 private _appDir;
17 get appDir(): string;
18 private _metadata;
19 get metadata(): Metadata;
20 private _nodeModulesHandledExternally;
21 get areNodeModulesHandledExternally(): boolean;
22 private _isPrepackedAppAsar;
23 get isPrepackedAppAsar(): boolean;
24 private _devMetadata;
25 get devMetadata(): Metadata | null;
26 private _configuration;
27 get config(): Configuration;
28 isTwoPackageJsonProjectLayoutUsed: boolean;
29 readonly eventEmitter: EventEmitter<[never]>;
30 _appInfo: AppInfo | null;
31 get appInfo(): AppInfo;
32 readonly tempDirManager: TmpDir;
33 private _repositoryInfo;
34 private readonly afterPackHandlers;
35 readonly options: PackagerOptions;
36 readonly debugLogger: DebugLogger;
37 get repositoryInfo(): Promise<SourceRepositoryInfo | null>;
38 private nodeDependencyInfo;
39 getNodeDependencyInfo(platform: Platform | null, flatten?: boolean): Lazy<Array<NodeModuleInfo | NodeModuleDirInfo>>;
40 stageDirPathCustomizer: (target: Target, packager: PlatformPackager<any>, arch: Arch) => string;
41 private _buildResourcesDir;
42 get buildResourcesDir(): string;
43 get relativeBuildResourcesDirname(): string;
44 private _framework;
45 get framework(): Framework;
46 private readonly toDispose;
47 disposeOnBuildFinish(disposer: () => Promise<void>): void;
48 constructor(options: PackagerOptions, cancellationToken?: CancellationToken);
49 addAfterPackHandler(handler: (context: AfterPackContext) => Promise<any> | null): void;
50 artifactCreated(handler: (event: ArtifactCreated) => void): Packager;
51 callArtifactBuildStarted(event: ArtifactBuildStarted, logFields?: any): Promise<void>;
52 /**
53 * Only for sub artifacts (update info), for main artifacts use `callArtifactBuildCompleted`.
54 */
55 dispatchArtifactCreated(event: ArtifactCreated): void;
56 callArtifactBuildCompleted(event: ArtifactCreated): Promise<void>;
57 callAppxManifestCreated(path: string): Promise<void>;
58 callMsiProjectCreated(path: string): Promise<void>;
59 validateConfig(): Promise<void>;
60 build(repositoryInfo?: SourceRepositoryInfo): Promise<BuildResult>;
61 private readProjectMetadataIfTwoPackageStructureOrPrepacked;
62 private doBuild;
63 private createHelper;
64 installAppDependencies(platform: Platform, arch: Arch): Promise<any>;
65 afterPack(context: AfterPackContext): Promise<any>;
66}
67export interface BuildResult {
68 readonly outDir: string;
69 readonly artifactPaths: Array<string>;
70 readonly platformToTargets: Map<Platform, Map<string, Target>>;
71 readonly configuration: Configuration;
72}