Filesystem
Schema Cache Module
In-memory cache for parsed extension schemas.
Provides lazy-loading schema caching without file watchers. File watching belongs in the VSCode extension layer.
Classes
Schema Parsing Module
Schema parsing for _schema.yml, _schema.yaml, and _schema.json files.
Provides functions to find, parse, and read Quarto extension schemas.
Interfaces
Variables
Functions
SchemaCache
Defined in: packages/schema/src/filesystem/schema-cache.ts:19
Cache for parsed extension schemas. Schemas are loaded lazily on first access.
Constructors
Constructor
TypeScript
new SchemaCache(): SchemaCache;Returns
SchemaCache
Methods
get()
TypeScript
get(extensionDir): ExtensionSchema | null;Defined in: packages/schema/src/filesystem/schema-cache.ts:30
Get the schema for an extension directory. Loads and caches the schema on first access.
Parameters
| Parameter | Type | Description |
|---|---|---|
extensionDir |
string |
Path to the extension directory |
Returns
ExtensionSchema | null
Parsed schema or null if no schema file exists
getError()
TypeScript
getError(extensionDir): string | null;Defined in: packages/schema/src/filesystem/schema-cache.ts:57
Get the parse error for a schema in the given directory, if any.
Parameters
| Parameter | Type | Description |
|---|---|---|
extensionDir |
string |
Path to the extension directory |
Returns
string | null
Error message or null if no error occurred
has()
TypeScript
has(extensionDir): boolean;Defined in: packages/schema/src/filesystem/schema-cache.ts:67
Check whether a schema is cached for the given directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
extensionDir |
string |
Path to the extension directory |
Returns
boolean
True if a schema is cached
invalidate()
TypeScript
invalidate(extensionDir): void;Defined in: packages/schema/src/filesystem/schema-cache.ts:76
Invalidate the cached schema for a specific extension directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
extensionDir |
string |
Path to the extension directory |
Returns
void
invalidateAll()
TypeScript
invalidateAll(): void;Defined in: packages/schema/src/filesystem/schema-cache.ts:84
Invalidate all cached schemas.
Returns
void
findSchemaFile
TypeScript
function findSchemaFile(directory): string | null;Defined in: packages/schema/src/filesystem/schema.ts:38
Find the schema file in a directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory to search |
Returns
string | null
Path to schema file or null if not found
parseSchemaContent
TypeScript
function parseSchemaContent(
content,
sourcePath?,
format?): ExtensionSchema;Defined in: packages/schema/src/filesystem/schema.ts:86
Parse schema content from a YAML or JSON string.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
content |
string |
undefined |
Schema content (YAML or JSON) |
sourcePath? |
string |
undefined |
Source path for error messages (optional) |
format? |
"json" | "yaml" |
"yaml" |
Content format: “yaml” (default) or “json” |
Returns
Parsed schema
Throws
SchemaError if parsing fails
parseSchemaFile
TypeScript
function parseSchemaFile(schemaPath): ExtensionSchema;Defined in: packages/schema/src/filesystem/schema.ts:62
Parse a schema file from a path.
Parameters
| Parameter | Type | Description |
|---|---|---|
schemaPath |
string |
Full path to the schema file |
Returns
Parsed schema
Throws
SchemaError if parsing fails
readSchema
TypeScript
function readSchema(directory): SchemaReadResult | null;Defined in: packages/schema/src/filesystem/schema.ts:127
Read a schema from a directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory containing the schema |
Returns
SchemaReadResult | null
SchemaReadResult or null if no schema found
SchemaReadResult
Defined in: packages/schema/src/filesystem/schema.ts:23
Result of reading a schema file.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
filename |
string |
Filename used (e.g., “_schema.yml” or “_schema.json”). | packages/schema/src/filesystem/schema.ts:29 |
schema |
ExtensionSchema |
Parsed schema data. | packages/schema/src/filesystem/schema.ts:25 |
schemaPath |
string |
Full path to the schema file. | packages/schema/src/filesystem/schema.ts:27 |
SCHEMA_FILENAMES
TypeScript
const SCHEMA_FILENAMES: readonly ["_schema.json", "_schema.yml", "_schema.yaml"];Defined in: packages/schema/src/filesystem/schema.ts:18
Supported schema file names, ordered by precedence (JSON first).