import type { EsmxDeclaration } from './types'; import { type Diagnostic } from './types'; /** * JSON Schema (draft 2020-12) for the package.json `esmx` field. * Exported for external tooling and publishing; `validateDeclaration` * enforces the same constraints structurally without a schema-validator * dependency. */ export declare const esmxDeclarationSchema: { readonly $schema: "https://json-schema.org/draft/2020-12/schema"; readonly $id: "https://esmx.dev/schema/esmx-declaration.json"; readonly title: "Esmx module declaration (package.json \"esmx\" field)"; readonly type: "object"; readonly additionalProperties: false; readonly properties: { readonly entry: { readonly type: "object"; readonly additionalProperties: false; readonly properties: { readonly client: { readonly $ref: "#/$defs/relativePath"; }; readonly server: { readonly $ref: "#/$defs/relativePath"; }; }; }; readonly exports: { readonly type: "object"; readonly propertyNames: { readonly pattern: "^\\./.+"; }; readonly additionalProperties: { readonly anyOf: readonly [{ readonly $ref: "#/$defs/relativePath"; }, { readonly type: "object"; readonly additionalProperties: false; readonly properties: { readonly client: { readonly $ref: "#/$defs/forkValue"; }; readonly server: { readonly $ref: "#/$defs/forkValue"; }; }; }]; }; }; readonly provides: { readonly type: "array"; readonly items: { readonly type: "string"; readonly minLength: 1; }; }; readonly uses: { readonly type: "array"; readonly items: { readonly type: "string"; readonly minLength: 1; }; }; }; readonly $defs: { readonly relativePath: { readonly type: "string"; readonly pattern: "^\\./.+"; }; readonly forkValue: { readonly anyOf: readonly [{ readonly $ref: "#/$defs/relativePath"; }, { readonly const: false; }]; }; }; }; export interface ValidateDeclarationResult { declaration: EsmxDeclaration | null; diagnostics: Diagnostic[]; } /** * Structural validator enforcing `esmxDeclarationSchema`. Invalid pieces * are dropped and reported; the returned declaration keeps the valid rest * so downstream diagnostics stay meaningful. Returns a null declaration * only when the field itself is not an object. */ export declare function validateDeclaration(value: unknown, moduleName: string): ValidateDeclarationResult;