UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

49 lines (48 loc) 2.09 kB
import ProjectInfoItem from "./ProjectInfoItem"; import ProjectItem from "../app/ProjectItem"; import IProjectInfoItemGenerator from "./IProjectItemInfoGenerator"; import ProjectInfoSet from "./ProjectInfoSet"; import ContentIndex from "../core/ContentIndex"; import { IValidationContext } from "../dataform/DataFormValidator"; import IFormDefinition from "../dataform/IFormDefinition"; export declare enum FormSchemaItemInfoGeneratorTest { couldNotParseJson = 401, couldNotFindForm = 402 } /** * Validates JSON files against Minecraft documentation-based form schemas. * * @see {@link ../../public/data/forms/mctoolsval/jsonf.form.json} for topic definitions */ export default class FormSchemaItemInfoGenerator implements IProjectInfoItemGenerator { id: string; title: string; canAlwaysProcess: boolean; _schemaContentByPath: { [id: string]: object; }; /** * Cache of loaded form definitions keyed by formPath. * Avoids redundant Database.ensureFormLoadedByPath() calls for items sharing the same form. * * Lifecycle: This generator is instantiated once per validation run by GeneratorRegistrations. * Caches are valid for the duration of a single ProjectInfoSet.generate() call and are * naturally discarded when the generator instance is garbage-collected after the run. */ _formCache: Map<string, IFormDefinition | null>; /** * Cache of validation contexts keyed by formPath. * Items with the same form share a subForm cache, avoiding repeated async subForm lookups. * * Lifecycle: Same as _formCache — scoped to a single validation run. */ _contextCache: Map<string, IValidationContext>; uuidRegex: RegExp; constructor(); summarize(info: any, infoSet: ProjectInfoSet): void; loadSchema(uri: string): Promise<any>; generate(projectItem: ProjectItem, contentIndex: ContentIndex): Promise<ProjectInfoItem[]>; testUuid(uuidString: string): boolean; testUnknownFormat(formatString: string): boolean; testUri(uriString: string): boolean; }