UNPKG

2.7 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Arch, DebugLogger, TmpDir } from "builder-util";
3import { CancellationToken } from "builder-util-runtime";
4import { EventEmitter } from "events";
5import { AppInfo } from "./appInfo";
6import { AfterPackContext, Configuration, Framework, Platform, SourceRepositoryInfo, Target } from "./index";
7import { Metadata } from "./options/metadata";
8import { ArtifactCreated, PackagerOptions } from "./packagerApi";
9import { PlatformPackager } from "./platformPackager";
10export declare class Packager {
11 readonly cancellationToken: CancellationToken;
12 readonly projectDir: string;
13 private _appDir;
14 readonly appDir: string;
15 private _metadata;
16 readonly metadata: Metadata;
17 private _nodeModulesHandledExternally;
18 readonly areNodeModulesHandledExternally: boolean;
19 private _isPrepackedAppAsar;
20 readonly isPrepackedAppAsar: boolean;
21 private _devMetadata;
22 readonly devMetadata: Metadata | null;
23 private _configuration;
24 readonly config: Configuration;
25 isTwoPackageJsonProjectLayoutUsed: boolean;
26 readonly eventEmitter: EventEmitter;
27 _appInfo: AppInfo | null;
28 readonly appInfo: AppInfo;
29 readonly tempDirManager: TmpDir;
30 private _repositoryInfo;
31 private readonly afterPackHandlers;
32 readonly options: PackagerOptions;
33 readonly debugLogger: DebugLogger;
34 readonly repositoryInfo: Promise<SourceRepositoryInfo | null>;
35 private _productionDeps;
36 private readonly productionDeps;
37 stageDirPathCustomizer: (target: Target, packager: PlatformPackager<any>, arch: Arch) => string;
38 private _buildResourcesDir;
39 readonly buildResourcesDir: string;
40 readonly relativeBuildResourcesDirname: string;
41 private _framework;
42 readonly framework: Framework;
43 constructor(options: PackagerOptions, cancellationToken?: CancellationToken);
44 addAfterPackHandler(handler: (context: AfterPackContext) => Promise<any> | null): void;
45 artifactCreated(handler: (event: ArtifactCreated) => void): Packager;
46 dispatchArtifactCreated(event: ArtifactCreated): void;
47 build(): Promise<BuildResult>;
48 _build(configuration: Configuration, metadata: Metadata, devMetadata: Metadata | null, repositoryInfo?: SourceRepositoryInfo): Promise<BuildResult>;
49 private readProjectMetadataIfTwoPackageStructureOrPrepacked;
50 private doBuild;
51 private createHelper;
52 private installAppDependencies;
53 afterPack(context: AfterPackContext): Promise<any>;
54}
55export interface BuildResult {
56 readonly outDir: string;
57 readonly artifactPaths: Array<string>;
58 readonly platformToTargets: Map<Platform, Map<string, Target>>;
59 readonly configuration: Configuration;
60}