Filesystem
Extension Discovery Module
Extension discovery from the filesystem.
Scans the _extensions directory to find installed Quarto extensions.
Interfaces
Functions
Manifest Parsing Module
Manifest parsing for _extension.yml files.
Provides functions to read, parse, and write Quarto extension manifests.
Interfaces
Variables
Functions
Directory Walking Module
Directory walking and file collection utilities.
Provides recursive directory traversal and file copying operations.
Interfaces
Type Aliases
Functions
collectFiles
TypeScript
function collectFiles(directory): Promise<string[]>;Defined in: packages/core/src/filesystem/walk.ts:62
Collect all file paths in a directory recursively.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory to walk |
Returns
Promise<string[]>
Array of file paths
copyDirectory
TypeScript
function copyDirectory(sourceDir, targetDir): Promise<string[]>;Defined in: packages/core/src/filesystem/walk.ts:99
Copy a directory recursively.
Parameters
| Parameter | Type | Description |
|---|---|---|
sourceDir |
string |
Source directory |
targetDir |
string |
Target directory |
Returns
Promise<string[]>
Array of created file paths
discoverInstalledExtensions
TypeScript
function discoverInstalledExtensions(projectDir, options?): Promise<InstalledExtension[]>;Defined in: packages/core/src/filesystem/discovery.ts:82
Discover all installed extensions in a project.
Scans the _extensions directory for extensions in both formats:
- _extensions/owner/name/_extension.yml (with owner)
- _extensions/name/_extension.yml (without owner)
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
options |
DiscoveryOptions |
Discovery options |
Returns
Promise<InstalledExtension[]>
Array of installed extensions
Example
TypeScript
const extensions = await discoverInstalledExtensions("./my-project");
for (const ext of extensions) {
console.log(`${ext.id.owner ?? ""}/${ext.id.name}: ${ext.manifest.version}`);
}discoverInstalledExtensionsSync
TypeScript
function discoverInstalledExtensionsSync(projectDir, options?): InstalledExtension[];Defined in: packages/core/src/filesystem/discovery.ts:99
Synchronous version of discoverInstalledExtensions.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
options |
DiscoveryOptions |
Discovery options |
Returns
Array of installed extensions
findInstalledExtension
TypeScript
function findInstalledExtension(projectDir, extensionId): Promise<
| InstalledExtension
| null>;Defined in: packages/core/src/filesystem/discovery.ts:203
Find a specific installed extension by ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
extensionId |
ExtensionId |
Extension ID to find |
Returns
Promise< | InstalledExtension | null>
InstalledExtension or null if not found
findManifestFile
TypeScript
function findManifestFile(directory): string | null;Defined in: packages/core/src/filesystem/manifest.ts:38
Find the manifest file in a directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory to search |
Returns
string | null
Path to manifest file or null if not found
getExtensionInstallPath
TypeScript
function getExtensionInstallPath(projectDir, extensionId): string;Defined in: packages/core/src/filesystem/discovery.ts:239
Get the installation path for an extension.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
extensionId |
ExtensionId |
Extension ID |
Returns
string
Path where the extension should be installed
getExtensionsDir
TypeScript
function getExtensionsDir(projectDir): string;Defined in: packages/core/src/filesystem/discovery.ts:48
Get the extensions directory path for a project.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
Returns
string
Path to _extensions directory
hasExtensionsDir
TypeScript
function hasExtensionsDir(projectDir): boolean;Defined in: packages/core/src/filesystem/discovery.ts:58
Check if an extensions directory exists.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
Returns
boolean
True if _extensions directory exists
hasManifest
TypeScript
function hasManifest(directory): boolean;Defined in: packages/core/src/filesystem/manifest.ts:127
Check if a directory contains a manifest file.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory to check |
Returns
boolean
True if manifest exists
parseManifestContent
TypeScript
function parseManifestContent(content, sourcePath?): ExtensionManifest;Defined in: packages/core/src/filesystem/manifest.ts:78
Parse manifest content from a YAML string.
Parameters
| Parameter | Type | Description |
|---|---|---|
content |
string |
YAML content |
sourcePath? |
string |
Source path for error messages (optional) |
Returns
Parsed manifest
Throws
ManifestError if parsing fails
parseManifestFile
TypeScript
function parseManifestFile(manifestPath): ExtensionManifest;Defined in: packages/core/src/filesystem/manifest.ts:55
Parse a manifest file from a path.
Parameters
| Parameter | Type | Description |
|---|---|---|
manifestPath |
string |
Full path to the manifest file |
Returns
Parsed manifest
Throws
ManifestError if parsing fails
pathExists
TypeScript
function pathExists(filePath): Promise<boolean>;Defined in: packages/core/src/filesystem/walk.ts:83
Async check whether a path exists on disk.
Prefer this over fs.existsSync in async code paths to avoid blocking the event loop.
Parameters
| Parameter | Type | Description |
|---|---|---|
filePath |
string |
Path to check |
Returns
Promise<boolean>
True if the path exists
readManifest
TypeScript
function readManifest(directory):
| ManifestReadResult
| null;Defined in: packages/core/src/filesystem/manifest.ts:104
Read a manifest from a directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory containing the manifest |
Returns
| ManifestReadResult | null
ManifestReadResult or null if no manifest found
updateManifestSource
TypeScript
function updateManifestSource(
manifestPath,
source,
sourceType?): void;Defined in: packages/core/src/filesystem/manifest.ts:197
Update the source field in an existing manifest file.
Parameters
| Parameter | Type | Description |
|---|---|---|
manifestPath |
string |
Path to the manifest file |
source |
string |
New source value |
sourceType? |
SourceType |
Type of source (github, url, local, registry) |
Returns
void
walkDirectory
TypeScript
function walkDirectory(directory, callback): Promise<void>;Defined in: packages/core/src/filesystem/walk.ts:37
Walk a directory recursively, calling the callback for each entry.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory to walk |
callback |
WalkCallback |
Callback for each entry |
Returns
Promise<void>
writeManifest
TypeScript
function writeManifest(manifestPath, manifest): void;Defined in: packages/core/src/filesystem/manifest.ts:137
Write a manifest to a file.
Parameters
| Parameter | Type | Description |
|---|---|---|
manifestPath |
string |
Path to write the manifest |
manifest |
ExtensionManifest |
Manifest data to write |
Returns
void
DiscoveryOptions
Defined in: packages/core/src/filesystem/discovery.ts:37
Options for extension discovery.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
includeInvalid? |
boolean |
Include extensions without valid manifests. | packages/core/src/filesystem/discovery.ts:39 |
InstalledExtension
Defined in: packages/core/src/filesystem/discovery.ts:23
An installed extension discovered on the filesystem.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
directory |
string |
Full path to the extension directory. | packages/core/src/filesystem/discovery.ts:31 |
id |
ExtensionId |
Extension identifier. | packages/core/src/filesystem/discovery.ts:25 |
manifest |
ExtensionManifest |
Parsed manifest data. | packages/core/src/filesystem/discovery.ts:27 |
manifestPath |
string |
Full path to the manifest file. | packages/core/src/filesystem/discovery.ts:29 |
ManifestReadResult
Defined in: packages/core/src/filesystem/manifest.ts:23
Result of reading a manifest file.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
filename |
string |
Filename used (e.g., “_extension.yml”). | packages/core/src/filesystem/manifest.ts:29 |
manifest |
ExtensionManifest |
Parsed manifest data. | packages/core/src/filesystem/manifest.ts:25 |
manifestPath |
string |
Full path to the manifest file. | packages/core/src/filesystem/manifest.ts:27 |
WalkEntry
Defined in: packages/core/src/filesystem/walk.ts:16
Entry information for directory walking.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
isDirectory |
boolean |
Whether entry is a directory. | packages/core/src/filesystem/walk.ts:22 |
name |
string |
Entry name (basename). | packages/core/src/filesystem/walk.ts:20 |
path |
string |
Full path to the entry. | packages/core/src/filesystem/walk.ts:18 |
WalkCallback
TypeScript
type WalkCallback = (entry) => boolean | void | Promise<boolean | void>;Defined in: packages/core/src/filesystem/walk.ts:29
Callback for directory walking. Return false to skip processing children of a directory.
Parameters
| Parameter | Type |
|---|---|
entry |
WalkEntry |
Returns
boolean | void | Promise<boolean | void>
MANIFEST_FILENAMES
TypeScript
const MANIFEST_FILENAMES: readonly ["_extension.yml", "_extension.yaml"];Defined in: packages/core/src/filesystem/manifest.ts:18
Supported manifest file names.