@stackbit/sdk
Version:
70 lines • 3.38 kB
TypeScript
import { ModelsSource, ModelExtension } from '@stackbit/types';
import { ConfigValidationResult } from './config-validator';
import { ConfigError, ConfigLoadError, ModelLoadError, ConfigValidationError, StackbitConfigNotFoundError } from './config-errors';
import { Logger } from '../utils';
import type { Config, StackbitConfigWithPaths, Model } from './config-types';
import { WithReloadAndDestroy } from './config-loader-utils';
export type ConfigWithModelsPresetsResult = {
valid: boolean;
config: Config | null;
errors: ConfigError[];
};
export type ConfigWithModelsPresetsResultWithReloadDestroy = WithReloadAndDestroy<ConfigWithModelsPresetsResult>;
export declare function loadConfigWithModelsPresetsAndValidate({ dirPath, modelsSource, stackbitConfigESBuildOutDir, watchCallback, logger, isForcedGitCSI }: {
dirPath: string;
modelsSource?: ModelsSource;
stackbitConfigESBuildOutDir?: string;
watchCallback?: (result: ConfigWithModelsPresetsResult) => void;
logger?: Logger;
isForcedGitCSI?: boolean;
}): Promise<ConfigWithModelsPresetsResultWithReloadDestroy>;
export type LoadConfigWithModelsResult = {
config: Config | null;
errors: (ConfigLoadError | StackbitConfigNotFoundError | ModelLoadError | ConfigValidationError)[];
};
export type LoadConfigWithModelsResultWithReloadDestroy = WithReloadAndDestroy<LoadConfigWithModelsResult>;
export declare function loadConfigWithModels({ dirPath, stackbitConfigESBuildOutDir, watchCallback, logger }: {
dirPath: string;
stackbitConfigESBuildOutDir?: string;
watchCallback?: (result: LoadConfigWithModelsResult) => void;
logger?: Logger;
}): Promise<LoadConfigWithModelsResultWithReloadDestroy>;
export type LoadConfigResult = {
config: Config;
errors: ConfigValidationError[];
} | {
config: null;
errors: (ConfigLoadError | StackbitConfigNotFoundError)[];
};
export type LoadConfigResultWithReloadDestroy = WithReloadAndDestroy<LoadConfigResult>;
export declare function loadConfig({ dirPath, stackbitConfigESBuildOutDir, watchCallback, logger }: {
dirPath: string;
stackbitConfigESBuildOutDir?: string;
watchCallback?: (result: LoadConfigResult) => void;
logger?: Logger;
}): Promise<LoadConfigResultWithReloadDestroy>;
export declare function loadAndMergeModelsFromFiles(config: Config): Promise<{
config: Config;
errors: (ModelLoadError | ConfigValidationError)[];
}>;
export declare function validateAndNormalizeConfig(config: Config, isForcedGitCSI?: boolean): ConfigValidationResult;
export type LoadConfigFromDirResult = {
config: StackbitConfigWithPaths;
error: null;
} | {
config: null;
error: ConfigLoadError | StackbitConfigNotFoundError;
};
export type LoadConfigFromDirResultWithReloadDestroy = WithReloadAndDestroy<LoadConfigFromDirResult>;
export declare function loadConfigFromDir({ dirPath, stackbitConfigESBuildOutDir, watchCallback, logger }: {
dirPath: string;
stackbitConfigESBuildOutDir?: string;
watchCallback?: (result: LoadConfigFromDirResult) => void;
logger?: Logger;
}): Promise<LoadConfigFromDirResultWithReloadDestroy>;
export declare function mergeConfigModelsWithExternalModels({ configModels, externalModels, logger }: {
configModels: ModelExtension[];
externalModels: Model[];
logger?: Logger;
}): Model[];
//# sourceMappingURL=config-loader.d.ts.map