myst-cli
Version:
Command line tools for MyST
94 lines • 4.2 kB
TypeScript
import type { SiteConfig, SiteProject } from 'myst-config';
import type { LinkTransformer } from 'myst-transforms';
import { ReferenceState } from 'myst-transforms';
import type { SiteManifestOptions } from '../build/site/manifest.js';
import type { LocalProject, LocalProjectPage } from '../project/types.js';
import type { ISession } from '../session/types.js';
import { ImageExtensions } from '../utils/resolveExtension.js';
import type { TransformFn } from './mdast.js';
export type ProcessFileOptions = {
imageExtensions?: ImageExtensions[];
imageWriteFolder?: string;
imageAltOutputFolder?: string;
extraLinkTransformers?: LinkTransformer[];
extraTransforms?: TransformFn[];
/** Execute flag for notebooks */
execute?: boolean;
maxSizeWebp?: number;
};
export type ProcessProjectOptions = ProcessFileOptions & {
watchMode?: boolean;
writeTOC?: boolean;
writeDOIBib?: boolean;
writeFiles?: boolean;
reloadProject?: boolean;
checkLinks?: boolean;
strict?: boolean;
};
export type ProcessSiteOptions = ProcessProjectOptions & SiteManifestOptions;
/**
* Trigger a file-changed notification, and clear the file from the cache
*
* @param session session with logging
* @param path path to the changed file
* @param eventType event corresponding to the change
*/
export declare function changeFile(session: ISession, path: string, eventType: string): void;
export declare function writeSiteManifest(session: ISession, opts?: SiteManifestOptions): Promise<void>;
/**
* Write myst.xref.json file from collected page reference states
*
* @param session session with logging
* @param states page reference states
*/
export declare function writeMystXRefJson(session: ISession, states: ReferenceState[]): Promise<void>;
export declare function writeMystSearchJson(session: ISession, pages: LocalProjectPage[]): Promise<void>;
/**
* Write objects.inv file from collected page reference states
*
* @param session session with logging
* @param states page reference states
* @param siteConfig site configuration to pull project metadata
*/
export declare function writeObjectsInv(session: ISession, states: ReferenceState[], siteConfig: SiteConfig): Promise<void>;
export declare function loadProject(session: ISession, projectPath: string, opts?: {
writeTOC?: boolean;
reloadProject?: boolean;
}): Promise<{
project: LocalProject;
pages: LocalProjectPage[];
}>;
/**
* Finalize and return list of page ReferenceStates
*
* This adds file information to the corresponding state, which may
* have been modified after the state was created. It also builds
* indices and adds additional reference targets to pages that include
* an index. Unless `opts.suppressWarnings` is true, this will log a
* warning when multiple identifiers are encountered across pages.
*
* This function should be used as part of the mdast processing pipeline.
* Initial page processing and state creation occurs in `processMdast`.
* Then this function should be invoked before `postProcessMdast`, as that
* function assumes all page ReferenceStates are fully resolved.
*/
export declare function selectPageReferenceStates(session: ISession, pages: {
file: string;
}[], opts?: {
suppressWarnings?: boolean;
}): ReferenceState[];
export declare function writeFile(session: ISession, { file, pageSlug, projectSlug, projectPath, }: {
file: string;
pageSlug: string;
projectSlug?: string;
projectPath?: string;
}): Promise<void>;
export declare function fastProcessFile(session: ISession, { file, pageSlug, projectPath, projectSlug, imageExtensions, imageWriteFolder, imageAltOutputFolder, extraLinkTransformers, extraTransforms, defaultTemplate, execute, maxSizeWebp, }: {
file: string;
pageSlug?: string;
projectPath: string;
projectSlug?: string;
} & ProcessFileOptions & SiteManifestOptions): Promise<void>;
export declare function processProject(session: ISession, siteProject: Partial<SiteProject>, opts?: ProcessProjectOptions): Promise<LocalProject>;
export declare function processSite(session: ISession, opts?: ProcessSiteOptions): Promise<boolean>;
//# sourceMappingURL=site.d.ts.map