@pakk/core
Version:
The core library of pakk, that can manage your package.json for library development.
43 lines • 2.36 kB
TypeScript
import { Logger } from '@alexaegis/logging';
import { PackageJson, WorkspacePackage } from '@alexaegis/workspace-tools';
import { LibraryFormats } from 'vite';
import { PackageJsonKindType } from '../package-json/package-json-kind.enum.js';
import { PackageExaminationResult } from '../plugins/pakk-feature.type.js';
import { NormalizedPakkContext, NormalizedPakkOptions, PakkContext, PakkOptions } from './pakk.class.options.js';
export declare const createIsFeatureEnabled: (enabledFeatures: PakkFeatureName[], disabledFeatures: PakkFeatureName[]) => (feature: PakkFeatureName) => boolean;
export declare const pakkFeatures: readonly ["bin", "copy-license", "export", "export-static", "metadata", "peer", "sort", "directive", "remove-workspace-directive"];
export type PakkFeatureName = (typeof pakkFeatures)[number];
/**
* This class does not execute anything on it's own, just provides itself as a
* tool that then needs to be orchestrated by another tool. This could be
* the standalone runner or the vite plugin. It also does not hold state,
* the packageJson object that is being worked on has to be stored elsewhere
* to avoid inner mutation.
*/
export declare class Pakk {
readonly options: NormalizedPakkOptions;
readonly context: NormalizedPakkContext;
private features;
private constructor();
getLogger(): Logger<unknown>;
getTargetPackageJsonKinds(): PackageJsonKindType[];
static withContext(manualContext: Pick<PakkContext, 'formats' | 'fileName'>, rawOptions?: PakkOptions | undefined): Promise<Pakk>;
static primaryLibraryFormat(packageJson: PackageJson): LibraryFormats;
/**
* 1st step, examining the package. This step does not write anything.
* It can be done before the build takes place as it's only supposed to
* take a look at your source code.
*/
examinePackage(workspacePackage?: WorkspacePackage): Promise<PackageExaminationResult>;
/**
* Will return a path adjusted packageJson object based on the content of
* the workspace for both the SOURCE and DISTRIBUTION packageJson files.
*
* And also returns the path where it should be written to.
*/
createUpdatedPackageJson(packageJsonKind: PackageJsonKindType): Promise<{
updatedPackageJson: PackageJson;
path: string;
}>;
}
//# sourceMappingURL=pakk.class.d.ts.map