Skip to content

@gluonjs/core / packages/quarks/src / validateComponentLibraryManifest

Function: validateComponentLibraryManifest() ​

validateComponentLibraryManifest(value): ComponentLibraryManifestValidation

Validates untrusted JSON before a loader uses it for module resolution. The result contains all structural errors and never performs an import.

Parameters ​

value ​

unknown

Returns ​

ComponentLibraryManifestValidation

Example ​

Validate a serializable component-library manifest before a consumer resolves any requested public module:

ts
import { validateComponentLibraryManifest, type ComponentLibraryEntry, type ComponentLibraryManifest, type ComponentLibraryManifestValidation } from '@gluonjs/quarks';

const entry = {
  id: 'product-configurator',
  module: '@acme/shop-components/product-configurator',
  exportName: 'ProductConfigurator',
  layer: 'element',
  tag: 'acme-product-configurator',
  styles: ['acme-product-configurator'],
  dependencies: [],
  accessibility: 'Uses labelled native choices.',
} as const satisfies ComponentLibraryEntry;
const manifest = { schemaVersion: 1, name: '@acme/shop-components', entries: [entry] } as const satisfies ComponentLibraryManifest;
const result: ComponentLibraryManifestValidation = validateComponentLibraryManifest(manifest);
if (!result.valid) throw new Error(result.errors.join('\n'));
console.log(manifest.entries[0]?.module);

Version-matched documentation. Examples are checked against the public package contracts.